Pat PatAtWork

Niner since 2010


  • Screencast - Creating Your First WCF Client


    Run service (without debugger). In Client project, Add Service Reference with the address from the service (e.g. http://localhost:8731/service/mex) and select the interface of interest. This should also add the required WCF references.

    In Main, create a new client and pass the constructor the name of the endpoint taken from the client project's app.config file (in the client element) (e.g. WSHttpBinding_IEvalService).

    To run both the service and the client, r-click on the solution and set multiple startup projects.

    To prevent VS test client from showing up, open service project properties and, in Debug[Start Options], change the /client commandline args (e.g. to the relative directory of your custom client).

  • Screencast - Hosting WCF Services in Windows Services


    Add System.ServiceModel to bring in the WCF namespaces. Add reference to service project.

    Create a new ServiceHost(typeof(MyService)). Use host.Open() and host.Close() in OnStart and OnStop, respectively.

    Copy app.config from the WCF service library to the Windows service project, possibly editing (e.g. metadata behavior).

    In design view, right-click and "add installer". For 'serviceProcessInstaller', maybe change the account to "LocalSystem" (to register http endpoints with httpsys [whatever that means]).

    Use 'installutil' from the commandline (e.g. installutil WindowServiceHost.exe) to install the service. Then use 'services.msc' snap-in to start/stop/edit windows service. If you start the service, you can browse to the endpoint URL (e.g. http://localhost:8080/evalservice) to see the documentation and WSDL.

  • Screencast - Configuring Services with Endpoints


    "TCP and named pipes are really only good when you have WCF on both ends."


  • Screencast - Configuring Services with Endpoints

    Why does the speaker use 'localhost' in his TCP and named pipe endpoints? Is this a requirement, or could they just as easily drop that part of the name (especially if the service is only running on the local computer)?