I added a new option to our web.config file today under the appConfig section. There was nothing special about this entry. It used a key / value pair where the key was a string and the value an integer. Again, nothing special. I added a comment above and closed the file.
Next I ran the debugger to test my recent changes. To my surprise I got a message box stating that the Debugger could not attach to the web server.
"Error while trying to run project: Unable to start debugging on the web server. Server side-error occurred on sending debug HTTP request.
Make sure the server is operating correctly. Verify there are no syntax errors in web.config by doing a Debug.Start without Debugging. You may also want to refer to the ASP.NET and ATL Server debugging topic in the online documentation."
(Note to self: read message boxes more carefully the first time in the future.)
Odd, I just debugged this thing a few minutes ago. Unshaken I rebooted my machine and waited; thinking that IIS had just temporarily gotten hung up. After the reboot, however, I got the following error when opening my project in Visual Studio 2003:
"The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost'. 'HTTP/1.1 500 Internal Server Error'.
<Sigh> One of those days I see.
I opened up Google and began to search for the solution. However, after poking around a bit I hadn't found anything that cured my problem. <sigh again>
At this point I started considering what changes I had made. What possibly could have effected the opening of a Visual Studio project. Ah hah! The web.config. I had changed the web.config! So, I opened up the file to look for typos. Hmmmm... nothing there. Everything looked fine. I removed my recent additions anyway, just to see if it would help.
It did! The file opened right up without error. Alright! Now to figure out what the problem was.
As it turns out the problem was part of the comment I had made for my recent configuration key. In my comment I had added multiple dashes (-----) as a separator for a example text I had added. As it turns out these dashes seem to have caused the Visual Studio project launcher to croak. Furthermore, they cause the Visual Studio compiler to be unable to function properly.
Example:
<!--
This is an example of what *NOT* to do in a web.config file.
You should not use multiple dashes like I do below.
Example:
--------
Blah
Blah
or it will cause problems
-->
So, the lesson here is: do not use multiple dashes (-----) in your comments for a web.config (or I'm guessing any .NET config file) or it will cause problems that are VERY difficult to track down.