Welcome to MSDN Blogs Sign in | Join | Help
From Exceptions to Faults

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

Posted: Saturday, January 12, 2008 5:47 PM by pedramr
Filed under:

Comments

Pedram Rezaei's Ramblings said:

I put together the following brief description of WCF Error Handling and some possible best practices

# January 25, 2008 6:27 PM

Noticias externas said:

I put together the following brief description of WCF Error Handling and some possible best practices

# January 25, 2008 7:19 PM

Mickey said:

I am using an ASMX service in my WCF service library. I am adding ASMX services as "Service References" in my WCF service library. I want to catch the soap exceptions thrown by the ASMX services. Can you please suggest me how can I do that?

# January 7, 2009 7:13 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker