When a single ClientBase<T>
instance is used for multiple WCF service calls, it can get a channel into a faulted state (ie. when the service is down).
I would like to heal the channel automatically when the service comes up again. The only way I found is to call the following code before each method call:
if (clientBase.InnerChannel.State == CommunicationState.Faulted)
{
clientBase.Abort();
((IDisposable)clientBase).Dispose();
clientBase = new SampleServiceClientBase();
}
I got the feeling that this isn't the right way to do it. Anyone got a better idea?