Suddenly, my ASP.NET web app wouldn’t start - there was an error like this: “The module ‘ErrorHandlingModule’ is already in the application and cannot be added again”.

I’m running the same app twice on one IIS, but in different virtual directories. The only workaround I could find was to rename the module in each Web.Config, so name="ErrorHandlingModule" became name="ErrorHandlingModule_Dev" and the equivalent for the production app, but then I found the reason:

There was a copy of Web.config from my app in the root directory used by IIS. For some reason, I had copied it from the virtual directory. Perhaps I was making a backup. This explains, though, why ErrorHandlingModule already existed in the application - it had been loaded globally.

This also explains why the web app that monitors CruiseControl.NET was complaining that it couldn’t load my application’s DLL. It shouldn’t have been attempting any such thing. The complaint from ccnet was what alerted me to the existence of the copy of Web.config.

No comments