localhost lookup fails, browser tries www.localhost.com instead

与世无争的帅哥 提交于 2019-12-12 10:53:10

问题


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


回答1:


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.




回答2:


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... ;)




回答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.




回答4:


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




回答5:


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.




回答6:


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



来源:https://stackoverflow.com/questions/657383/localhost-lookup-fails-browser-tries-www-localhost-com-instead

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!