WCF Exception handling

Topics: Exception Handling Application Block
Dec 3, 2008 at 8:25 AM
Edited Dec 3, 2008 at 8:26 AM

I have created 4 layers and four polices in enterprise library 4.0.
All the policy having posthandle action as "Notifyrethrow". While calling the service layer from the page i got the following error.

The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, Service Layer Policy]) failed: Object reference not set to an instance of an object. (Strategy type Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy, index 2)

After googling i found some people told check the enterpriselibrary.wcf namespace in bin directory. I have checked that and it is available.But still not able solve the issue

The Sample code implemented in Service layer
catch (Exception ex)
            bool rethrow = ExceptionPolicy.HandleException(ex, "Service Layer Policy");
            if (rethrow)
                ServiceFault Fault = new ServiceFault();
                Fault.MessageText = "Login : " + ex.Message.ToString();             

If anybody will give the solution for this it would be great help to me.

one more thing i am not able debug through the service layer. I have enable the option debug = true in web.config files(Both - Service,main project)
Thanks in Advance.

Dec 3, 2008 at 9:05 AM
Edited Dec 3, 2008 at 9:14 AM
Where did you place your configuration file?  Usually this error occurs when it can't find the configuration file.  Make sure it is not in a class library project.

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.