0

I am learning WCF, and currently focusing on the Faults chapter.

As i understand, WCF handles FaultException exceptions a bit differently when thrown by a service.

As such, it seems like a good idea that all exceptions that are thrown from a service should be wrapped into a FaultException.

Design wise it seems a bit counter-intuitive for me with respect to the design that WCF seems to favor (a clean separation between the actual logic and the "service" configuration/hosting/service-like details).

Is this a good practice then? or is there any other technique that should be used?

lysergic-acid
  • 19,570
  • 21
  • 109
  • 218
  • What you are really asking is: [How should a WCF service implementation handle errors/faults without coupling to FaultContract][1] [1]: http://stackoverflow.com/questions/3789556/how-should-a-wcf-service-implementation-handle-errors-faults-without-coupling-to – ErnieL Aug 14 '12 at 04:36

2 Answers2

1

It is common practice to set up a FaultContract on your WCF service, which defines how it is has failed, and then handle this at the client side.

http://msdn.microsoft.com/en-us/library/ms733721.aspx

http://blogs.msdn.com/b/endpoint/archive/2011/01/14/wcf-spike-faultcontract-faultexception-lt-tdetail-gt-and-validation.aspx

podiluska
  • 50,950
  • 7
  • 98
  • 104
1

Take a look on following:

GSerjo
  • 4,725
  • 1
  • 36
  • 55