I've got a WCF service that's using Enterprise Library for its Exception Handling and WCF Validation Integration. They don't seem to work together.
What I want is:
- If my service throws any kind of exception, WCF Exception Shielding will catch this and throw out a
FaultException<MyServiceFault>
. - If the incoming message fails the validation, the service should continue to throw out a
FaultException<ValidationFault>
.
However, I don't know how to tell the Exception Shielding policy to let Validation exceptions through.
I have some Enterprise Library config that turns every exception into a FaultException<MyServiceFault>
. If I get EnterpriseLibrary to log the exceptions it catches, it says it gets a
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF.FaultContractWrapperException
when validation fails. But if add this exception to the config as a new <exceptionType>
with a postHandlingAction
of None
, I still get a FaultException<MyServiceFault>
thrown out when validation fails.
Is it possible to use WCF Exception Shielding to catch every exception other than WCF Validation exceptions? If not, I'll have to add tons more config for all the different exceptions that might be thrown - what is the point of exception shielding in this case?