localhost lookup fails, browser tries www.localhost.com instead
Asked Answered
K

6

6

I used to run web applications all the time on my laptop, no problems, I am using VWD 2008 Express, i have the latest framework, Windows Vista Home Basic...etc.. Now, when ever i try to run a website, or even chose to Show a Page in Browser from Within VWD, the browser (both IE and Firefox) keeps looking for www.localhost.com...

I tried to copy the address of and paste it directly in the title bar, nothing, same problem i tried to get that address from the balloon notification (the one that pops up when you run any ASP.net project), still nothing happens...

My colleague is facing the same problem, but for him, he can simply copy and paste the url in the address bar, but its not working with me....Heeeeeellllllllllllllllp

Kropp answered 18/3, 2009 at 8:35 Comment(0)
F
9

Check your hosts file, it should be redirecting localhost to 127.0.0.1 and nothing else. The entry that will cause this error should look like this:

127.0.0.1    www.localhost.com 

If you find this, remove it or change www.localhost.com to localhost.

You can also try to post one of these in the adress bar:

127.0.0.1
http://localhost

Note that the hosts file is a popular victim of viruses, so if is has been modified, you might run a check on viruses.

Also see the discussion here.

Fractionate answered 18/3, 2009 at 8:41 Comment(0)
B
3

If that also doesn't work, open up nod32 (you probably have it installed on your system if the above methods don't work) go to advanced setup, on the left menu, select protocol filtering, and select HTTP and POP3 ports... ;)

Bunyan answered 11/4, 2009 at 5:47 Comment(0)
C
3

I got the same problem in firefox 3.6 when my server was down. In my case it was not a problem with etc/hosts where the line

127.0.0.1 localhost

was there and OK.

The solution that worked for me was to disable the "cleaver" URL fixing that Firefox carry out when the page is not found. The procedure taken from here:

  1. Type about:config in the address bar and hit return.
  2. find browser.fixup.alternate.enabled
  3. double click the “true” value. The line will become bold, and the value will change to “false”

This fix directly the problem. No firefox restart needed. If your server is down you get "page not found" as expected. Hope it helps.

Cerf answered 3/9, 2010 at 7:55 Comment(1)
Thanks for this, this is exactly what I was trying to fix. (In the event I forget to start the server, I don't want to be redirected)Quitrent
C
3

Thank you for your solution ... this works fine...

I got the same problem in firefox 3.6 when my server was down. In my case it was not a problem with etc/hosts where the line

127.0.0.1 localhost

was there and OK.

The solution that worked for me was to disable the "cleaver" URL fixing that Firefox carry out when the page is not found. The procedure taken from here:

   1. Type about:config in the address bar and hit return.
   2. find browser.fixup.alternate.enabled
   3. double click the “true” value. The line will become bold, and

the value will change to “false”

This fix directly the problem. No firefox restart needed. If your server is down you get "page not found" as expected. Hope it helps. link|flag
answered Sep 3 at 7:55 joaquin 2,237112

Centipoise answered 5/11, 2010 at 9:29 Comment(2)
Thanks for this, fixed an issue I was having with Firefox 4 and .NETMediterranean
If you liked joaquin's solution, you should just vote it up, not copy and paste their answer. I've negged this because it's a copy and the copy-pasting of joaquin's content messed up the formatting and made it worse.Richman
C
1

A couple of random things to check...

  • localhost is the conventional name for the IP address 127.0.0.1. If that address doesn't work, then you have a network configuration problem.

  • There will be a hosts file somewhere, probably in somewhere like C:\Windows\System32\Drivers\Etc\hosts which should usually contain only that definition for localhost. If it has more names in it and you didn't put them there, then you have another problem entirely.

Crossquestion answered 18/3, 2009 at 8:41 Comment(0)
O
1

There is also the forehead-slapping possibility that your web server is not currently running. :)

Oldworld answered 19/11, 2009 at 15:30 Comment(2)
I just did that, I guess apache beats out iis in terms of startupDeadbeat
Eventually the server starts up but reloading the page continues to fail, because it is now pointing at "www.localhost.com:8080/whatever". That's not forehead-slapping, that's hair-tearing annoying.Simoneaux

© 2022 - 2024 — McMap. All rights reserved.