Can't establish a connection to the ASP.NET development server at localhost

March 23, 2009 12:13

I recently started getting "Failed to Connect, Firefox can't establish a connection to the server at localhost" when trying to debug a web page from Visual Studio using the ASP.NET development server. This was happening regardless of the project being new or not.

I found a temporary workaround: use 127.0.0.1 instead of "localhost". But this is a hassle because you have to edit the address each time.

Another workaround is to simply switch your project to use IIS instead of the ASP.NET development server:

image

This works, but is not ideal if you don't want to use IIS.

So, I did some digging and came up with this post which did the trick. The gist of it is to edit the "hosts" file which, in Vista, is located at "c:\windows\system32\drivers\etc\hosts" (you'll need admin rights to edit). If there's an entry called "::1 localhost", comment it out and add "127.0.0.1 localhost".

This worked like a charm for me.


Comments