Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

Enterprise Library Error: The entry ‘ExceptionPolicy’ has already been added

Posted by Keith Elder | Posted in Uncategorized | Posted on 15-05-2007

Today is trash day in the great Hub City of Hattiesburg.  While I was taking out the trash early this morning my phone rang.  It was an engineer at work calling to tell me that our web service in the test environment wasn’t responding.  I quickly threw my trash out and jumped on the situation.

My first question as I started to look into everything was “Who changed something?”.   Obviously computers just don’t stop magically working.  In my 15 years of dealing with computers there is always a reason.  I was of course told, no one changed anything.  Suuuuuuuuure.

I opened up my web browser and pointed it to the test environment, clicked on a web service call and typed in some bogus information hoping the service would fault, catch its exception and then log the error so I could see what was going on.  Instead I was greeted with this error:

System.Configuration.ConfigurationErrorsException: The entry ‘ExceptionPolicy’ has already been added. (C:\sites\myapp\web.config line 87)

This alerted me that this was an Enterprise Library error.  My initial reaction was the web.config file was misconfigured. I opened it up and and it appeared to be fine.  I decided to reset the config file to the one that was working on another test server and it still nothing.  Same error.  After redeploying the application and resetting IIS  still the same error.  Then it hit me what was happening.   Obviously the file was correct and worked on another server, something else must be inserting the exception policy somewhere.

We conference in one of the windows engineers and within a minute he said, yep, the configuration wasn’t right.  The way it was configured was the root folder of IIS was using the service and the virtual directory mappings were including itself twice.  Example:

http://testserver/myservice/service.asmx  => throwing the error above

http://testserver/service.asmx => worked fine

So you see the entire setup was misconfigured based on how we wanted things to be setup.  The windows engineer reconfigured everything and we were back in business.  Hopefully this will help someone else out in the future if you run into the same error.

Comments (7)

Thanks helped me a lot

güzel davteiye sözleri ve davetiye metinleri

davetiye sözleri ve davetiye metinleri

i had the same problem with File Configuration Source. Default Web Site’s config already had that configuration. Your post helped a lot. Thank You!

Had the same error but with Policy tag associated with Logging – found parent Default Web Site’s web.config already had Enterprise Library configuration. Thanks!!

Got the same prob. when web.config with same key values were found in the root folder as in the virtual directory.

Thanks. Hit this one this morning with a “works on my machine, but not anyone elses” scenario that was down to an IIS reconfiguration decision and was tearing my hair out over it until I found this entry.

Write a comment