Custom Search

Thursday, December 3, 2009

localhost not recognised in Windows Vista

The standard way to resolve that is to find the hosts file
and map your loopback address ( 127.0.0.1 ) to "localhost".

There's an issue connected to doing that on Vista.

The hosts file is considered a system file by Vista.
You have to first take ownership of it then grant yourself full control.

These are the two commands that you need to run from an elevated command prompt.
(Right click "command prompt" and choose "Run as Administrator") :

1.
takeown /f c:\windows\system32\drivers\etc\hosts

2.
icacls c:\windows\system32\drivers\etc\hosts /grant yourusername:f

If you installed to a drive other than "c:", modify accordingly, of course.

Now you can open the file with notepad, insert this line and save the hosts file
( make sure it doesn't acquire a .txt extension ) :

127.0.0.1 localhost

If that doesn't fix it, you have a bad install of the TCP/IP stack.


Copied from Juan T. Llibre, asp.net MVP

No comments: