Wednesday, November 24, 2010

What exceptions can a WCF channel throw?

It seems that expected exceptions from a WCF channel include:

  • TimeoutException
  • CommunicationException - FaultException, FaultException, EndpointNotFoundException etc.

MSDN describes the exceptions that are caused by communication errors.

Also from MSDN:

When implementing custom channels and binding elements, it is strongly recommended that your components throw only System.TimeoutException or CommunicationException-derived objects. In the case where your components throw a recoverable exception that is specific to the component, wrap that exception inside a CommunicationException object.

MSDN also describes how to specify and handle faults in WCF contracts and services.


Post a Comment