WCF Exception shielding and policies

Topics: Exception Handling Application Block
Feb 5, 2010 at 11:36 AM

I would like to use Exception handling application block in my project, in particular WCF exception shielding.

I suppose I would have two exception handling policies - Development and Production with different purposes and different handlers (the Production one with clearing some sensitive data).

When I setup these two policies I want to change policy only in configuration file (no code recompile). In case o standard catching syntax mechanism (ExceptionPolicy.HandleException(ex, "MyPolicy"))

I am able to retrieve policy name before calling HandleException (retrieve manually from application configuration).

In case of WCF exception shielding I have to use atrribute [ExceptionShielding("MyPolicy")] but I am not able to set policy name dynamically (again reading from conf. file).

Is there any solution to this problem? For example setting default exception handling policy directly in configuration file so I don´t have to specify policy name in code?


Feb 5, 2010 at 12:32 PM


In WCF exception shielding, you can use the


with the empty parameter, this means that it will search a policy in your config with a name of "WCF Exception Shielding".

Please read thru this:


Valiant Dudan
Global Technology and Solutions
Avanade, Inc.

Feb 5, 2010 at 1:21 PM

Yes, I am aware of this approach but it makes me to change on of policies name to default name you advised,

and if I have e.g. five different policies with defined names it would be uncomfortable especialy if If I would like to change this setting through application UI during runtime.

Much better soulution in my opinion will be something like DefaultExceptionPolicy in ExceptionPolicies xml tag.

Thanks anyway