I have two .NET C# windows forms applications that are communicating with each other via WCF named pipes. One of the applications is hosting a WCF service and the other is the client. Communication is working fine, the client can call service methods and callbacks work fine, etc. However, one issue I am having is if the host application shuts down, the client is not able to detect that the pipe is no longer available. I have tried registering event handlers on the pipe for all events (Closing, Closed, Faulted), but these never get called when the host application shuts down. Also, if I try to check the pipe state in the client with the pipe.State property, I get back a state of Opened even if the pipe is Faulted. Then of course it throws an exception if I try to call a service method. I either need to have my client application either be notified that the service is closing, closed, or faulted, or I need to be able to detect it before I make each service method call.
Does anyone have any working examples of this scenario?