I want to realize the schema, under which all the application-defined errors in my WCF service will be delivered to the clients, but the communication channel must remain in the Open
state.
At the current point the first task is realized by means of IncludeExceptionDetailInFaults = true
, but after the first exception the communication channel state moves from Open
to Fault
. How can I prevent such a behaviour (the corruption of the communication channel after the first exception in the service code)?
A faulted channel can't be closed and can't be used again. A faulted channel must be aborted by calling
Abort()
Method. Also instead of using"IncludeExceptionDetailInFaults = true"
, it would be better to throw aFaultExceptions
. And it is also recommended that you use theFaultContractAttribute
to design your services to return strongly-typed SOAP faults.