none
WCF ServiceHost with NetNamedPipeBinding loses it's underlying pipe but does not throw any error RRS feed

  • Question

  • I am trying to synchronize multiple WPF application instances using WCF and NamedPipes. 
    Every instance at startup creates its own service host and listens to a pipe (net.pipe://localhost/myapp/process/<processid>).

    When other instances want to communicate with a specific instance they just need to know its process id in order to build the target namedpipe url.

    Every instance try/catches the call to serviceHost.Open() and the call never throws an exception.
    After opening the host we add handlers for Faulted, Closing and Closed.

    I keep noticing that its very often that the underlying transports get killed for some reason and instances are unable to communicate with each other. Meaning that calls to remoteChannel.Open() throw exceptions with "No Endpoint listening ...".
    But i NEVER get any callback by any serviceHost that something has gone wrong! That the pipe no longer exists or something...

    Why does that happen? How can i overcome it?
    Communication between my instances is critical and there must be a way to know when to at least restart the transports or something.

    Thank you in advance.

    Tuesday, June 17, 2014 1:00 AM

Answers

  • Hi,

    Since you are using the NetNamedPipeBinding in your WCF Service, then please try to make sure that your service and client are in the same computer.

    Then also please make sure that the port number is not used by more than one process.

    Besides, please try to enable the wcf tracing to get more information.

    The following configuration taken from MSDN can be applied to enable tracing on your WCF service.

    <configuration>
      <system.diagnostics>
        <sources>
          <source name="System.ServiceModel"
                  switchValue="Information, ActivityTracing"
                  propagateActivity="true" >
            <listeners>
                 <add name="xml"/>
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging">
            <listeners>
                <add name="xml"/>
            </listeners>
          </source>
          <source name="myUserTraceSource"
                  switchValue="Information, ActivityTracing">
            <listeners>
                <add name="xml"/>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
            <add name="xml"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData="Error.svclog" />
        </sharedListeners>
      </system.diagnostics>
    </configuration>

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, June 18, 2014 8:03 AM
    Moderator