endpoint.tv Screencast - Self-hosting WCF Services

Sign in to queue

Description

Welcome to the latest video in the weekly WF/WCF Screencast series.

In this short video, CSD MVP Aaron Skonnard from PluralSight guides the viewer through how to self-host your WCF Service. The screencast walks you through adding an existing service (see the creating your first WCF service screencast on how to create one) to a new console application. In this screencast, we create a new console application project, and add the code needed to reference the service and host WCF endpoints. Aaron then walks you through how to add (and configure) the proper configuration information (refer to how to configure your your WCF Service with endpoints screencast for more information). Along the way, Aaron introduces how to work with the hosted endpoints programmatically.

For additional information on WCF, please check out the WCF Dev Center on MSDN and the .NET Endpoint team blog. For more information on classes offered by Aaron and the PluralSight folks, check out their catalog of instructor led courses and new online courses that cover a variety of Microsoft technologies, ranging from .NET v3.5 to WSS to BizTalk server.

Embed

Download

Download this episode

The Discussion

  • User profile image
    tmc2k
    Just after the 7:00 mark in the video the presenter runs into an unhandled exception. He stops the video to fix it, but we have no idea what he did. It looks like the instance of the service is still running and grabbing port 8080 first. How does he fix this?
  • User profile image
    JustCheck
    I noticed it too. I think the error was because there are endpoints with the same Port number in the other solution. Its just a guess.
    Aaron didn't do anything, and as said he just hit Ctrl+f5. I did the same and it didn't throw up any exception. But an explanation from Aaron on the cause of this would be great.
  • User profile image
    tmc2k
    Thanks for posting.
    I'm sure you are right about the Port number. I know there is a way to have multiple endpoints on the same port number. For this demo you are correct, he just 'ignored' the error by hitting ctrl+f5. I thought there might have been some more simple that I was missing.
    Thanks
  • User profile image
    aceguy
    Hi Aaron,
     The videos are simply superb !  It would be really nice if you could explain how to fix the error when you tried to launch the service using F5.
  • User profile image
    VMans795

    Hi Everyone!

    You can find Solution of the problem with explanation of its originin in the article

    Preventing the WCF Service Host from launching in Visual Studio 2008

    at Rick Rainey's Blog

    at http://blogs.msdn.com/rickrain/archive/2008/02/14/Preventing-the-WCF-Service-Host-from-launching-in-Visual-Studio-2008.aspx

    Good luck!

     

  • User profile image
    crazy.NET

    hi can any body help me in this video as I am not able to add the the reference name in my code that " using evalserviceLibrary" even I added the refernce to the application. so I am getting exception in the line

    servicehost host = new servicehost(typeof(evalservice);

     

    please help me

  • User profile image
    Jamison

    By default the WcfServieLibrary project you have will run it's own WCF host when any project in the solution starts.  To disable it, right click on the Wcf project, select properties, select the tab "Wcf Options", and then uncheck "Start WCF Service Host ...."  Save the change and try again.

     

  • User profile image
    angel3d3

    Hi! I am new in WCf and this videos have helped me a lot. But a have a problem, i created my own service doing everything showed in this video series and everything work properly in a console application. But when i do the same in a window form application i get a time out exception when execute client.submitPlayer(object1);.
    I even tried running the wcftextclient and everything worked properly is only from
    my window application
    Does any body can help me? any idea wil be wellcome
    this is my code:
    host.Open();        Console.WriteLine("The Service is up and running with the following endpoints: ");        foreach (ServiceEndpoint se in host.Description.Endpoints)            Console.WriteLine(se.Address.ToString());        Console.WriteLine("Press <Enter> to add a new object... ");        Console.ReadLine();        myServiceClient client = new myServiceClient();        myInfoService object1 = new myInfoService();        myInfoService object2 = new myInfoService();        object1.id = Guid.NewGuid().ToString();        object1.player = "MyPlayer";        object1.comments = "This come from host application";        object1.XMLPlayerInfo = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<PLAYER_INFO>\r\n  <ID>1</ID>\r\n  <PLAYER></PLAYER>\r\n  <ADDRESS>http://localhost:5000/myservice/ws</ADDRESS>\r\n  <AUTOMATION_SYSTEM>1</AUTOMATION_SYSTEM>\r\n  <POJECTION_SYSTEM>2</POJECTION_SYSTEM>\r\n  <SEND_PULSE_INTERVAL>0</SEND_PULSE_INTERVAL>\r\n  <AUTOMATION_TYPE>2</AUTOMATION_TYPE>\r\n  <TYPE_CONNECTION>RS-232</TYPE_CONNECTION>\r\n  <CURRENT_PLAYLIST_ID>5327</CURRENT_PLAYLIST_ID>\r\n  <PLAYLIST_AVAILABLE>True</PLAYLIST_AVAILABLE>\r\n  <SHOWTIME_INFO_AVAILABLE>True</SHOWTIME_INFO_AVAILABLE>\r\n  <GENERAL_LOAD_DATA_ERROR>False</GENERAL_LOAD_DATA_ERROR>\r\n  <PLAYER_INFO_AVAILABLE>True</PLAYER_INFO_AVAILABLE>\r\n  <IP_ADDRESS_PROJECTOR>127.0.0.1</IP_ADDRESS_PROJECTOR>\r\n  <PORT_PROJECTOR>7000</PORT_PROJECTOR>\r\n  <ENABLED>True</ENABLED>\r\n</PLAYER_INFO>";        client.submitPlayer(object1);        Console.WriteLine("object added successfully!!!");        Console.WriteLine("Press <Enter> to show the object... ");        Console.ReadLine();        object2 = client.GetPlayer();        Console.WriteLine(object2.id);        Console.WriteLine(object2.player);        Console.WriteLine(object2.comments);        Console.WriteLine(object2.XMLPlayerInfo);        Console.ReadLine();        host.Close();
     
    this is the exception tha i get:
    ex.Message = "This request operation sent to net.tcp://localhost:8888/playerservice
    did not receive a reply within the configured timeout (00:01:00).  
    The time allotted to this operation may have been a portion of a longer timeout.
    This may be because the service is st...

  • User profile image
    John Doe

    It would be great if you post your videos to download in other formats than wmv. thanks.

  • User profile image
    Sumesh KT

    Thanks , the presentation is great!!

  • User profile image
    Gokula​Krishnan

    Hai All,
    I have tried to download this series of video's(Windows Communication Foundation Screencasts). I have downloaded some of the video's. Most of the video's are not download. This is give error message as "Media failure. try reloading the page or visiting the main site for assistance".
    I have reloaded those pages which pages got error, it still no use.
    Any one guide me to download all the video's in this series. Do the needful ASAP..
    Regards,
    GokulaKrishnan.

  • User profile image
    Gustavo Garcia

    Hi,
    If it can help someone... I need to put a attribute to every endpoints setted in this screencast. Here is some info:
     http://social.msdn.microsoft.com/Forums/en/wcf/thread/439539ef-e8d7-4e7d-b36e-b80acd401606
    By the way, Great screencasts!!!

Add Your 2 Cents