How can I check if there is a WCF host before I use the channel from the client?

I am creating a Windows service that runs several subordinate processes. In each of these subordinate processes, I start listening to the named pipe for the message from the main process.

I currently have a situation where a master process calls a slave on a named pipe before the slave is fully started and starts listening on the named pipe.

    ProcessStartInfo processStartInfo = new ProcessStartInfo("slave");
    processStartInfo.Arguments = Address 

    Process process = new Process();
    process.StartInfo = processStartInfo;

    process.Start();

    base.Endpoint.Binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
    base.Endpoint.Address = Address;

    base.Channel.RemoteMethod();

If I do this, the channel falls into CommunicationState.Faulted, and any subsequent calls on the channel also do not work.

What can I do to check with the master that the slave process is being tapped? Or how do I recover from CommunicationState.Faultedto redo my deleted call?

+3
3

Faulted - WCF-, Open().

, , Status, , , . , . ( - , )

+1

"ServiceFaulted" . , - . , , .

0

, . , WCF (, "" ). , .

, WCF, "" , .

, , . ChannelFactory WCF . try catch, . System.Diagnostics.Debugger.Break() , , .

, ?

0

Source: https://habr.com/ru/post/1711791/


All Articles