Suppose, we have a WCF host, channel factory and channel:
var host = new ServiceHost(typeof(MyService));
host.AddServiceEndpoint(typeof(IMyService), new NetNamedPipeBinding(), new Uri(hostUrl));
host.Open();
var cf = new ChannelFactory<IMyService>(new NetNamedPipeBinding(), new EndpointAddress(hostUrl));
var ch = cf.CreateChannel();
// The breakpoint is here
Assuming that all objects are successfully created, opened and we are now at the breakpoint, when actually these three communication objects can become faulted?
Our channel will switch to CommunicationState.Faulted
if any exception is thrown during execution.
It is OK since we never reuse channels and it does not affect the channel factory and host.
What about the last two? What can make them switch to Faulted state?