简体   繁体   English

无法访问 127.0.0.1

[英]Can't access 127.0.0.1

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).我不知道这是什么时候开始发生的,但结果是 - 127.0.0.1 无法在任何地方的任何端口上工作(例如,浏览器显示无法连接)。 Here are the results of my research:以下是我的研究结果:

  1. localhost, COMPUTER_NAME and actual IP address all work fine localhost、COMPUTER_NAME 和实际的 IP 地址都可以正常工作
  2. there is nothing special in my hosts file我的主机文件中没有什么特别的
  3. ping to 127.0.0.1 and tracert do work fine ping 到 127.0.0.1 和 tracert 工作正常
  4. 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 )所有硬编码为 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 唯一的问题。

Just one command did the work 只有一个命令完成了工作

netsh http add iplisten 127.0.0.1 netsh http添加iplisten 127.0.0.1

If it's a DNS problem, you could try: 如果是DNS问题,则可以尝试:

  • ipconfig /flushdns ipconfig / flushdns
  • ipconfig /registerdns ipconfig /注册域名

If this doesn't fix it, you could try editing the hosts file located here: 如果仍不能解决问题,则可以尝试编辑位于此处的hosts文件:

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

In windows first check under services if world wide web publishing services is running. 在Windows中,首先在服务下检查是否正在运行万维网发布服务。 If not start it. 如果没有启动。

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". 如果找不到它,请打开Windows的IIS功能:在7,8,10中,它位于控制面板下,“打开或关闭Windows功能”。 Internet Information Services World Wide web services and Internet information Services Hostable Core are required. Internet信息服务需要万维网服务和Internet信息服务Hostable Core。 Not sure if there is another way to get it going on windows, but this worked for me for all browsers. 不知道是否还有其他方法可以在Windows上运行它,但这对所有浏览器都有效。 You might need to add localhost or http:/127.0.0.1 to the trusted websites also under IE settings. 您可能还需要在IE设置下将localhost或http:/127.0.0.1添加到受信任的网站。

I had a similar issue.我有一个类似的问题。 Check your listen port.检查您的侦听端口。 A mistake I made ealier was我更早犯的一个错误是

app.listen(() => console.log(APP_NAME} is listening on port ${PORT}`))

Make sure you include the port as shown below确保包含如下所示的端口

app.listen(PORT, () =>{
  console.log(`${APP_NAME} is listening on port ${PORT}`)
})

This answer may seem overly obvious, but in most cases it is sufficient to simply remove the "localhost" entry in the "Host Name" field:这个答案可能看起来过于明显,但在大多数情况下,只需删除“主机名”字段中的“localhost”条目就足够了:

设置窗口

In the end for us, it was IE11 that was blocking for 127.0.0.1 - after adding it to the exceptions list, it loaded the page.最后对我们来说,是 IE11 阻止了 127.0.0.1 - 在将其添加到例外列表后,它加载了页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么无法使用任何端口连接到127.0.0.1上的http服务绑定 - Why can't connect to http service binding on 127.0.0.1 with any ports Python套接字绑定到0.0.0.0,无法通过127.0.0.1连接 - Python Socket bound on 0.0.0.0, can't connect via 127.0.0.1 无法运行 Windows 应用程序驱动地址“http://127.0.0.1:4723/”已被使用 - Can't run Windows Application Driver Address 'http://127.0.0.1:4723/' is already in use 无法通过HttpClient连接到UWP中的127.0.0.1(localhost)设备门户(仅限Windows 10 Mobile RS1) - Can't connect to 127.0.0.1 (localhost) Device Portal in UWP by HttpClient or else (Windows 10 Mobile RS1 only) 无法连接到 http://127.0.0.1:8000/ 或外部 IP 上的简单 Http 服务器 - Can't Connect to my Simple Http Server on http://127.0.0.1:8000/ or external IP windows 使用 --network=host 运行 docker 并使用 127.0.0.1 访问 - windows run docker with --network=host and access with 127.0.0.1 在Windows 7上无法连接到服务器127.0.0.1:27017 - Couldn't connect to server 127.0.0.1:27017 on Windows 7 127.0.0.1 适用于 Chrome 但不适用于 Edge - 127.0.0.1 works in Chrome but doesn't work in Edge 如何从 Ubuntu 生产服务器访问 Windows 机器上的 localhost 或 127.0.0.1? - How to access localhost or 127.0.0.1 on a Windows machine from Ubuntu Production Server? MySQL无法访问root@localhost - MySQL Can't Access root@localhost
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM