WCF Exception Handling Shielding Exception does not work

Topics: Exception Handling Application Block
May 26, 2013 at 6:25 PM
Edited May 26, 2013 at 6:35 PM
Hi All,

Shielding Exception did not work. On WCF Service I referenced Common, ExceptionHandling and ExceptionHandling.WCF. I am using the latest 6.0 dlls.

I am running a simple scenario where the Client (Console app) gets a FaultExcepion<myexceptiondatacontract> . However, it always seems to always catch in FaultException.

I already spent a day and desperately want this working.

Net Framework - 4.5
Enterprise Lib - 6.0

Sharing my test code at
share 1 - http://www.4shared.com/zip/y79_CUdX/ExceptionHandlingBlockDemo_1.html
share 2 - http://www.files.com/shared/51a25503bd244/ExceptionHandlingBlockDemo.zip

Appreciate any help.

p.s: If you're unable to access the above links - i could email source code.
May 28, 2013 at 6:37 PM
Tushar, thanks for posting a complete code sample.

If you are using declarative configuration with Enterprise Library 6 you need to explicitly load the configuration. An easy way to do this would be add the following to global.asax:
    public class Global : System.Web.HttpApplication
        protected void Application_Start(object sender, EventArgs e)
            ExceptionPolicy.SetExceptionManager(new ExceptionPolicyFactory().CreateManager());
If you do this then you should receive FaultException<WeGoofedFault> instead of just a FaultException.

Randy Levy
Enterprise Library support engineer
Support How-to
May 28, 2013 at 7:19 PM
Thank you so much Randy. It worked. I wasted so many hours figuring this out.

Really appreciate you resolve this for me.