我的笔记本电脑中有一个 ASP.net Web API,地址如下:
localhost:99949
我将此添加到 IIS Express,以便我可以从同一局域网中的另一台计算机访问我的 web Api,它是这样的:
Nimis:80
我可以从其他 PC 访问我的 web api,但是当我尝试使用我的 android 设备访问它时,它显示“网页不可用”错误。
我关闭了所有的防火墙。
我应该怎么做才能修复它?
最佳答案
您需要在防火墙中为端口 80(或您在 IIS 上用于网站的任何端口)添加入站规则:
Go to Control Panel, Windows Firewall
Select Inbound Rules
Add a New Rule
Select "Port" as a Rule Type
Select "TCP and put "80" (and any other ports you want to open) in "Specific local ports"
Select "Allow the connection"
Select the network location where the rule should apply
Give a name and an optional description
之后,您应该能够使用 http://computername 从同一网络中的其他设备访问您的网站。 (例如 http://myhomepc)
但是,您可能需要使用装有 Android 的服务器机器的 IP。它似乎总是使用 Google 的服务器覆盖其 DNS 条目。在这种情况下,尝试按照说明修改 DNS 设置 here .
关于android - 如何从 Android 设备访问本地主机网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19121479/