custom software and consulting
using the latest Microsoft technologies

Specialized software and web development
Login www.insidelogic.nl « Blog

  Search

apr 6

Written by: Dimitri Stoikof
6-4-2009 18:12 

For some time my Visual Studio has had a problem displaying web pages when debugging, and if you've been keeping your windows updates running, most likely you've got the same problem.

This happens when you're using the built-in web server and Visual Studio uses http:localhost: /site. In fact, any reference to localhost fails to find the page you're looking for.

Turns out that an update to Windows Defender messed around with the hosts file which lists host names and matches them to predefined IP addresses. This file resides in C:\Windows\System32\drivers\etc (on Vista at least) and you'll find the following line inside:

::1             localhost

It should be:

127.0.0.1 localhost

Problem solved!

Tags:

2 comment(s) so far...

Re: 'localhost' no longer working in Visual Studio?

Hi Dimitri,
Thanks for your tip: finally it works!!
I added a new line. Or should I rather replace the existing ::1 line?

Thanks,

Edgar

By Edgar Walther on   6-10-2009 19:12

Re: 'localhost' no longer working in Visual Studio?

Hey Edgar,

Both should work, quite strange, my new Windows 7 installation works just fine using the ::1, although my old Vista and your new Windows 7 don't like it...

By Dimitri Stoikof on   6-10-2009 19:23

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel