Web.config and IIS7 Woes

Today I spent the majority of my day trying to debug why our QA environment would not work to only figure out one of the two issues.

It was supposed to be a simple 30 minute x-copy deploy but it turned into an almost 7 hour deployment.

The first set of issues were basic server setup issues like ASP.NET and WCF not being registered properly into IIS. Once I was able to finally get the website up and running against the QA database I discovered a major bug. Of course I hadn’t encountered it in my development environment and just like the old saying “It worked on my machine!” Truth be told I don’t like that saying very much but it is usually unfortunately true. As most developers know the hardest type of bugs to find are the ones you can’t reproduce easily.

Now I have a major bug that is going to cause QA some headaches but on top of that I discover that JavaScript code is not working. The ASP.NET AJAX functionality was not working properly and was even causing the Infragistics controls to not function at all on some of my pages. This was a bigger issue than the major one I found initially. After spending way to long on this issue trying to determine if it was an Infragistincs control issue or if it was a server setup issue or an IIS configuration issue here is what I found to be the problem:

The <system.web> section is for IIS6 and below; whereas, the <system.webServer> section is for IIS7. The issue was I had the <httpHandlers> section in the <system.web> section which I thought was enough; however, I did not have the <handlers> section in the <system.webServer> section.

Unfortunately this code was in my web.config in the version that is checked into TFS but some how it was removed which caused me to waste over half my day debugging issues. So hopefully this blog post will help someone else not waste a half day like I did or if I come across this issue again I can hopefully remember to search my blog before wasting too much time!