Robert Smith Robert Smith - 10 months ago 75
C# Question

Cannot access a named pipe WCF service inside a class library C#

Folks, how do I access a WCF service I added to a class library? Here are the steps I took:

  1. Create a C# class library from vs2013.

  2. Right click on the class library, add "New Item", select "WCF Service".

  3. Set binding to named pipes as shown in the sample microsoft (i updated the below to use my namespace but just showing as an example):

    <endpoint address="net.pipe://localhost/ServiceModelSamples/service"
    contract="Microsoft.ServiceModel.Samples.ICalculator" />

  4. Create a winforms project within the same solution and add a reference to the class library created above.

  5. Run (not debug) the winforms project, the class library being referenced.

  6. Create another winforms project, attempt to add a reference to the named pipe that is running in step 5 above. This is done by clicking on "Add Service Reference", then put in the name of the WCF: net.pipe://localhost/ServiceModelSamples/service. When I click on go, the service is not found.

What did I miss? Thanks before hand.

Note: I put above:


But in the code it has the correct namespaces. Just showing as an example.

Answer Source

Found the answer! I was missing to start the named pipe. It does not start automatically like http hosted wcf's.

// Open Service Host