windows 无法访问 127.0.0.1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34543443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't access 127.0.0.1
提问by Lanayx
I can't figure out when this started to happen, but the result is - 127.0.0.1 is not working on any port from anywhere (for example, browser says Unable to connect). Here are the results of my research:
我不知道这是什么时候开始发生的,但结果是 - 127.0.0.1 无法在任何地方的任何端口上工作(例如,浏览器显示无法连接)。以下是我的研究结果:
- localhost, COMPUTER_NAME and actual IP address all work fine
- there is nothing special in my hosts file
- ping to 127.0.0.1 and tracert do work fine
- all the programs that have 127.0.0.1 hardcoded are not working (this point makes me disappointed the most, because I can't do anything in this case )
- localhost、COMPUTER_NAME 和实际 IP 地址都可以正常工作
- 我的主机文件中没有什么特别的
- ping 127.0.0.1 和 tracert 工作正常
- 所有硬编码为 127.0.0.1 的程序都不起作用(这一点让我最失望,因为在这种情况下我无能为力)
What else can I do to identify the source of problem and fix it?
我还能做些什么来确定问题的根源并修复它?
UPDATE: as soon as Redis does work on 127.0.0.1 and both IIS and AzureStorageEmulator don't work I assume this is HTTP only issue.
更新:一旦 Redis 在 127.0.0.1 上运行并且 IIS 和 AzureStorageEmulator 都不起作用,我认为这只是 HTTP 的问题。
回答by Lanayx
Just one command did the work
只需一个命令即可完成工作
netsh http add iplisten 127.0.0.1
netsh http 添加 iplisten 127.0.0.1
回答by Penguinparty
If it's a DNS problem, you could try:
如果是 DNS 问题,您可以尝试:
- ipconfig /flushdns
- ipconfig /registerdns
- ipconfig /flushdns
- ipconfig /注册DNS
If this doesn't fix it, you could try editing the hosts file located here:
如果这不能解决它,您可以尝试编辑位于此处的主机文件:
C:\Windows\System32\drivers\etc\hosts
And ensure that this line (and no other line referencing localhost) is in there:
并确保该行(没有其他引用 localhost 的行)在那里:
127.0.0.1 localhost
回答by Gregor Schmitz
In windows first check under services if world wide web publishing services is running. If not start it.
如果万维网发布服务正在运行,首先在 Windows 下检查服务。如果没有启动它。
If you cannot find it switch on IIS features of windows: In 7,8,10 it is under control panel , "turn windows features on or off". Internet Information Services World Wide web services and Internet information Services Hostable Core are required. Not sure if there is another way to get it going on windows, but this worked for me for all browsers. You might need to add localhost or http:/127.0.0.1 to the trusted websites also under IE settings.
如果找不到它,请打开 Windows 的 IIS 功能:在 7、8、10 中,它位于控制面板下的“打开或关闭 Windows 功能”。需要 Internet 信息服务万维网服务和 Internet 信息服务 Hostable Core。不确定是否有另一种方法可以让它在 Windows 上运行,但这对所有浏览器都适用。您可能还需要在 IE 设置下将 localhost 或 http:/127.0.0.1 添加到受信任的网站。