I came across an issue at a client I was at and I was banging my head against the wall for a while. So I thought I should share. I was developing an HTTPModule that was being added to the web.config through a SharePoint feature. This part was working fine then all of a sudden the site starting throwing “500 Internal Server Error” messages. So I figured ok, I’ll just check Event Viewer for the machine. What did I find, nothing out of the ordinary. I tried a few other things including completely removing my HTTPModule and still no dice. So I tried resetting IIS, rebooting the machine, none of it worked. So I figured I would double check and make sure the module was removed.
So I went into IIS and selected the web site that I was working with. I then double clicked on the Modules option and was presented with an error “Cannot read configuration file because it exceeds the maximum file size”. So after a quick search on Bing I found that apparently ASP.Net has a limitation that the web.config file cannot exceed 250 KB. So I checked my config file and it was 257 KB. So I trimmed out some duplicated lines caused by another web.config modification from a feature and then the site came back up. So for anyone out there, hopefully this is helpful.