The Joy of ASP.NET, Visual Studio and Proxies

Some time ago, the web project I was working on started refusing to open. Every time I tried to reload the ASP.NET project, Visual Studio (In this case, VS.NET 2003, but it may affect 2005 and 2008) gave a strange error message:

The Web server reported the following error when attempting to create or open the Web project located at the following URL:
‘http://localhost:/xyz/ACME.XYZ.Widget’. ‘The connection with the server was reset’.

The project files hadn’t changed and I hadn’t made any changes to IIS recently. In my search for a solution, I come across someone else having problems creating ASP.NET projects from Visual Studio on a network that used a proxy, getting the message ‘A connection with the server could not be established’ – this proved to be the key to the answer. In short, Visual Studio needs to support environments where your ASP.NET project is not hosted on your own machine, so it uses the system’s proxy settings.

In my case, under Control Panel > Internet Options > Connections > LAN Settings…, I had enabled Use a proxy server for your LAN but had neglected to also tick the Bypass proxy server for local addresses checkbox. When Visual Studio gave the proxy a request for localhost, the proxy responded by closing the connection, and thus Visual Studio came back with the error message. Simple, logical, and entirely frustrating.