How should a WCF service implementation handle errors/faults without coupling to FaultContract?

For decoupling error handling from your service implementation, have your service implement IErrorHandler. This allows you to throw standard . NET exceptions in your service code.

The IErrorHandler behavior translates them to SOAP faults at the service level There's lots of examples on the web. The one I like most is here because I actually made the same mistake with fault actions that he points how to fix.

For decoupling error handling from your service implementation, have your service implement IErrorHandler. This allows you to throw standard . NET exceptions in your service code.

The IErrorHandler behavior translates them to SOAP faults at the service level. There's lots of examples on the web. The one I like most is here because I actually made the same mistake with fault actions that he points how to fix.

1 Yes, IErrorHandler looks like the key. Thanks for the link. Here's another good guide: olegsych.Com/2008/07/simplifying-wcf-using-exceptions-as-faults – RyanW Sep 24 '10 at 20:11.

Use FaultContract in operations if you want to throw expected exception. You will get some small set of FaultContracts used in your operations. When you need to add non SOAP endpoint you can use IErrorHandler implementation in custom endpoint behavior and convert thrown FaultExceptions to format you need.

Here you have some example for JSON.

Thanks. I agree IErrorHanler is the key, and I gave @ErnieL the accepted answer because he was first. I also prefer the idea of keeping FaultContract completely out of the implementation and convert from .

NET Exception to FaultContract in the IErrorHandler code. – RyanW Sep 24 '10 at 20:13.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions