WCF Exception Shielding with webHttpBinding?

Topics: Exception Handling Application Block
Jun 30, 2009 at 10:11 PM

Does exception shielding work with webHttpBinding (JSON/AJAX) and if so, is there a usage pattern or example that someone can point me to?

My understanding is that webHttpBinding implements a different error handler that "swallows" the exception information that is provided in a fault type.   That seems  bit drastic when you consider that you may want to return validation information as part of a fault (i.e. what DTO property failed validation and why).  

While there is the possibility of adding a custom error handler using the IError interface, etc.  it would be nice if the enterprise library provided some mechanism for throwing faults that was compatible with the Microsoft Ajax library and the service proxies it generates.   Understandably, there might be limitations on the datacontract that can be used when rethrowing the fault.  However, some control over the fault is better than none.    It seems a lot of people are recreating the wheel when it comes to this usage pattern.

Thank you,



Jul 1, 2009 at 11:27 AM

Your understanding about webHttpBinding is correct, so the exception shielding doesn't work.  But as you already know, you can get around this by creating your own implementation of IErrorHandler.  Enterprise Library doesn't have support for this, the REST starter kit might do something like what you want - http://msdn.microsoft.com/en-us/netframework/cc950529.aspx.  I haven't used it but seems like it allows you to add additional error details

Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.