为什么Microsoft Edge会打开一些本地网站,而不能打开其他网站,其中域名在hosts文件中路由到127.0.0.1 [英] Why does Microsoft Edge open some local websites, but not others, where the domain name is routed to 127.0.0.1 in hosts file

查看:35
本文介绍了为什么Microsoft Edge会打开一些本地网站,而不能打开其他网站,其中域名在hosts文件中路由到127.0.0.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像许多程序员一样,我在本地测试网站.
我使用 hosts 文件将域名映射到我的本地 ip (127.0.0.1).

Like a lot of programmers, I test sites locally.
I use the hosts file to map domain names to my local ip (127.0.0.1).

我使用限定域名,通常带有d"子域(用于开发").

I use qualified domain names, usually with a "d" subdomain (for "development").

例如:

d.somewebsite.com 
d.anotherwebsite.com 
and so on...

在 Microsoft Edge 中,大多数网站都可以正常工作.但是,其中一些没有.不起作用的域名没有什么特别或奇怪的地方.只是一个简单的 d.someletters.com.

In Microsoft edge, most of the web sites work. However, a couple of them do not. There is nothing special or weird about the domain names that won't work. Just a simple d.someletters.com.

它们在 Chrome、IE 和 Firefox 中运行良好.

They work fine in Chrome, IE, and Firefox.

在 Edge 中,我收到错误消息:嗯,我们无法访问此页面."

起初我以为它没有解析 IP.但是,我意识到当我在另一个不相关的 url 上打错字时,不是由 hosts 文件路由的请求会被发送到我的 ISP 进行解析.如果我的 ISP 无法解决它,他们会发回这个特殊的搜索结果页面,其中包含您可能要查找的内容的建议.好吧,当我转到我的本地域时,我没有从我的 ISP 那里得到这个页面.我直接从边缘得到了上面提到的错误.

At first I thought it wasn't resolving the IP. However, I realized when I made a typo on another non-related url, that requests which are not routed by the hosts file are sent to my ISP to be resolved. If my ISP can't resolve it, they send back this special search results page with suggestions of what you might be trying to find. Well, when I go to my local domain, I do not get this page from my ISP. I get the error mentioned above straight from edge.

所以,在我看来,Edge 正在正确解析域,否则它会被发送到我的 ISP 的 DNS.

So, it seems to me that Edge is resolving the domain correctly, otherwise it would have been sent off to my ISP's DNS.

所以,我认为 Edge 可能无法连接到本地计算机.但就像我说的,其中几个本地域运行良好.此外,直接在 Edge 中使用 127.0.0.1 也可以.只是这几个域名给了我一个问题.并且仅在 Edge 中(所有其他浏览器都可以)有什么想法吗?

So, I would think then that maybe Edge just can't connect to the local machine. But like I said, several of these local domains are working fine. Also, using 127.0.0.1 directly in Edge also works. It's just these couple of domain names giving me a problem. And only in Edge (all other browsers work) Any ideas?

Web 服务器是适用于 Windows 的 Apache2 (xampp),如果这很重要的话.

The web server is Apache2 for Windows (xampp) if that matters.

另外,如果我在 Edge 中打开调试窗口并监控网络,我根本看不到任何请求发出.

Also, if I open the debug window in Edge and monitor the network, I do not see any requests going out at all.

我不再使用主机文件.我在我的一台 Linux 机器上运行 dnsmasq,我将它用于 DNS 而不是主机.也不再使用环回(显然因为 DNS 现在在另一个盒子上),我使用的是内部私有 IP 地址(192.168 ...).同样的问题.

I am no longer using the hosts file. I have dnsmasq running on one of my Linux boxes and I am using it for DNS instead of hosts. Also no longer using loopback (obviously since DNS is on another box now), I am using an internal private ip address (192.168...). Same issue.

推荐答案

  • 您的网络可以阻止环回作为 Windows 10 中的一项安全措施.

    • Your network can block loopback as a security measure in Windows 10.

      以管理员身份打开命令提示符,并运行此命令以使 Edge 免受环回:

      Open a command prompt as administrator, and run this to exempt Edge from a loopback:

      CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
      

    • (Microsoft.MicrosoftEdge_8wekyb3d8bbwe 是 Edge 应用的标识符)

      (Microsoft.MicrosoftEdge_8wekyb3d8bbwe is the identifier for the Edge app)

      这里有一篇博文提供了更多详细信息:https://blogs.msdn.microsoft.com/msgulfcommunity/2015/07/01/how-to-debug-localhost-on-microsoft-edge/

      There's a blog post here giving more detail: https://blogs.msdn.microsoft.com/msgulfcommunity/2015/07/01/how-to-debug-localhost-on-microsoft-edge/

      这篇关于为什么Microsoft Edge会打开一些本地网站,而不能打开其他网站,其中域名在hosts文件中路由到127.0.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆