无法在本地计算机上浏览在家中托管的网站 [英] Can't browse a website hosted at home on local machine

查看:181
本文介绍了无法在本地计算机上浏览在家中托管的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS上主页上有一个ASP.NET网站。在我的家庭网络之外我可以看到网站,但在网络内部它给我一个404错误。我可以将该网站浏览为localhost。这似乎是一个DNS问题,只是不知道如何解决它。

I have an ASP.NET website hosted at home on IIS. Outside my home network i can see the website, but inside the network it gives me a 404 error. I can browse the site as localhost. It seems like a DNS problem, just not sure how to fix it.

推荐答案

这几乎肯定是一个NAT问题。我假设您的Web服务器位于NAT路由器后面,并且您已将一些端口(可能是80)从路由器的外部接口转发到服务器计算机上的端口80。我还假设您尝试使用解析为外部IP的名称(可能是动态DNS名称)访问您的网站,或者您尝试使用该外部IP直接访问它。这可能无法开箱即用,因为大多数NAT路由器只会为路由器外部接口上的数据包提供端口映射。

That's almost certainly a NAT problem. I assume your web server sits behind a NAT router and you've forwarded some port (probably 80) from the external interface of the router to port 80 on your server machine. I also assume you're trying to access your website either using a name which resolves to your external IP (probably a dynamic DNS name), or you're trying to access it directly using that external IP. This will probably not work out of the box since most NAT routers will only make the port mapping available for packets coming in on the router's external interface.

如果上述情况属实,有四种可能的解决方案:

If the above holds true, there are four possible solutions:


  1. 查看路由器的配置并尝试查找类似于NAT环回的内容, Ext-int loopback等。这将指示路由器处理来自内部接口并发往外部IP的数据包,就像处理来自外部接口的数据包一样,有效地正确地回送流量。这将触发端口转发,您的网站将工作。并非所有路由器都有此选项,但如果您使用此选项,那将是最强大的解决方案。如果你没有,你也可以尝试将其固件更改为支持你的路由器(Tomato,OpenWRT,DD-WRT等)的免费固件之一我用过番茄成功用于此类情景。

当你落后时使用内部IP路由器和外部路由器。

Use the internal IP when you're behind the router and the external one when outside.

将您正在使用的DNS名称添加到您自己的主机文件中,使其与内部IP相对应。当从您自己的主机访问名称时,这将自动实现(3)。您必须为路由器后面的每个主机重复此操作。

Add the DNS name you're using to your own hosts file making it correspond to the internal IP. This will achieve (3) automatically when accessing the name from your own host. You will have to repeat this for every single host behind your router.

在路由器后面运行您自己的DNS服务器,使其声明您的DNS记录和将其解析为内部IP,同时将其他DNS查询转发到您的实际名称服务器。

Run your own DNS server behind the router, make it claim authority over your DNS record and resolve it to the internal IP, while forwarding the other DNS queries to your actual name server.

这篇关于无法在本地计算机上浏览在家中托管的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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