This Error happens because a .NET exception has occurred at WCF service server side. Due to this error Communication Object (or Proxy Class) has been disturbed results in the communication break-down between WCF Service and Client and hence, came to a faulted state.
Things You can do in order to cope with this:
Handle the Exception(Use Try- Catch / Throw an Exception): Don't Catch the Dot Net Exception (there is a reason why you should not use Dot Net Exception: As you are using WCF, whose one of the motto is Interoperability. By using .NET Exception you are sacrificing that).
Use FaultException Instead !!!
If you want to recreate the Communication channel between WCF Service and Client, you just need to instantiate the Proxy Class.
You can check whether the communication is in faulted state or not by :
Things You can do in order to cope with this:
Handle the Exception(Use Try- Catch / Throw an Exception): Don't Catch the Dot Net Exception (there is a reason why you should not use Dot Net Exception: As you are using WCF, whose one of the motto is Interoperability. By using .NET Exception you are sacrificing that).
Use FaultException Instead !!!
If you want to recreate the Communication channel between WCF Service and Client, you just need to instantiate the Proxy Class.
You can check whether the communication is in faulted state or not by :
if(client.InnerChannel.State != System.ServiceModel.CommunicationState.Faulted)
{
// call service - everything's fine
}
else
{
// channel faulted - re-create your client and then try again
}
Happy Coding !!!

No comments:
Post a Comment