| Frank 的个人资料Frank de Groot日志列表 | 帮助 |
|
11月15日 Combining Validation and Exception with WCF and EntLib integrationBoth WCF/EntLib integration for Validation and Exception handling are cool, but combining them is a bit tricky. EntLib's Exception handling allows you to send a generic SOAP fault to a client if any Exception occurs within your service. This allows you to hide exception details from the client. Unfortunately a ValidationFault also gets translated to this generic service fault. The solution: in the EntLib configuration, under your exception policy for your WCF service (usually named "WCF Exception Shielding" add an entry for the System.ServiceModel.FaultException and set it to NotifyRethrow besides catching System.Exception and throwing a custom SOAP fault in its place. The specific exception to rethrow would be FaultException<ValidationFault> but I'm not sure how to configure EntLib for this. Fortunately the order is not important: the EntLib configuration tool orders the added exception types alphabetically so it automatically puts the FaultException after the generic Exception handler, but it works just the same. 引用通告此日志的引用通告 URL 是: http://frankdegroot.spaces.live.com/blog/cns!5F59721C89C5188!168.trak 引用此项的网络日志
|
|
|