c# - WCF Service Exception Handling -


I have developed a WCF service that is used to communicate with the database. I consumed this service from my WPF application to access the database. In the future, we are planning to create a web client too. Currently we are hosting the service in the server as a window service.

My question is here, if any exception is put on the server, then I want to inform the client about the exception. In addition to this, I do not want to kill the service. How can I Can I get it?

For the former: If the database went offline, when the service tries to reach that DB, it throws an exception. I did not try to catch those exceptions with these unrestricted exceptions My WCF service stops.

Methods you can create a FaultContract for your WCF service. When an exception occurs on the server, you can throw a FaultException, the client side can capture this FaultException and handle it.

I hope this link is helpful


Comments