android - 如何从 Android 设备访问本地主机网站

标签 android iis localhost

我的笔记本电脑中有一个 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/

相关文章:

android - Activity 泄露了最初在此处注册的 IntentReceiver com.mopub.mobileads.MoPubView。您是否错过了对 unregisterReceiver() 的调用?

asp.net - 捕获 IIS 级别的错误以在 ASP.NET 中处理

asp.net-mvc - 哪些可能导致 "Service Unavailable 503"错误?

php - 如何将参数传递给 bat 文件中的 php 脚本

php - 使用 XAMPP 托管多个本地站点

android - 横向模式下的自动完成 TextView - 下拉菜单上的键盘

Google Play 中的 Android APK 大小限制

php - 在黑莓上运行 apache、php 和 mysql

java - BaseAdapter.notifyDataSetChanged 不更新其 ListView

IIS7 上的 ASP.NET 应用程序 - iisreset 后启动非常慢