如何从安卓设备访问本地主机网站

Mas*_*mie 5 iis android localhost

我的笔记本电脑中有一个 ASP.net Web API,地址如下:

本地主机:99949

我将它添加到 IIS Express,我可以从同一局域网中的另一台计算机访问我的 web Api,它是这样的:

尼米斯:80

我可以从其他 PC 访问我的 web api,但是当我尝试使用我的 android 设备访问它时,它显示“网页不可用”错误。

我关闭了所有防火墙。

我该怎么做才能解决它?

Zia*_*iad 4

您需要在防火墙中为端口 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
Run Code Online (Sandbox Code Playgroud)

之后,您应该能够使用http://computername(例如http://myhomepc)从同一网络中的其他设备访问您的站点

但是,您可能需要使用 Android 服务器计算机的 IP。它似乎总是使用 Google 的服务器覆盖其 DNS 条目。在这种情况下,请尝试按照此处的说明修改 DNS 设置。