From Exceptions to Faults

From Exceptions to Faults

  • Comments 4

A question that I often get asked during workshops on WCF is “Why does WCF use Faults instead of .NET Exceptions?”

Exceptions expose a set of limitations and possible security risks:

-          They are platform/technology specific: .NET exceptions may have no meaning on other platforms

-          Exceptions can cause tight-coupling between clients and service.

o   Clients need to understand exactly what exceptions can be thrown by each operation

-          Flowing exceptions to clients may expose service implementation details

-          Flowing exceptions to clients may expose private and personal information

-          Exceptions and exception hierarchies are not easily represented using metadata

Therefore a map between exceptions on the service and their equivalent on the client is required. This is achieved using SOAP Faults.
It is worth mentioning that exceptions that reach WCF clients are represented as FaultException.

$0.02

Leave a Comment
  • Please add 4 and 6 and type the answer here:
  • Post
Page 1 of 1 (4 items)