Errors Handling in WCF - how to pass the error to client as well as remain the channel in the "Open" state

94 views Asked by At

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)?

1

There are 1 answers

0
Salah Akbari On BEST ANSWER

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 a FaultExceptions. And it is also recommended that you use the FaultContractAttribute to design your services to return strongly-typed SOAP faults.