www.localhost.com is displayed when trying to debug in Visual Studio

Visual Studio Debug Issue

I posted about this issue in the previous version of my blog but I came up against it recently on my new home PC so I thought I'd blog about it again, if only so I can check this out the next time it happens to me.

Problem: Visual Studio 2008 incorrectly defaults to showing the url www.localhost.com when opening a browser for debugging which stops your page from loading.

Solution: You can type in your local home IP address - 127.0.0.1 - in place of www.localhost.com Visual Studio put in the browser URL but this means that you have to wait for ages for the browser to stop searching for www.localhost.com before it will let you type this in. What you should do is locate the following file:

C:\Windows\System32\drivers\etc\hosts

Open it in Notepade and remove the line that says

::1             localhost

If you can't overwrite the existing file because of Vista's UAC then save to your desktop as a txt. Once saved, knock off the .txt part of the filename you just saved and then copy and paste the file into the Windows\System32\drivers\etc. Click Yes to overwrite the existing file. Your debugged site will now show up with the correct address. Easy when you know how....I won't say how long I was looking for that solution!


Share this post


blog comments powered by Disqus

Updates

Follow me online at TwitterFacebook or Flickr. If you want to get in touch with me try emailing me.

Latest Tweets