【问题标题】:Access WebAPI running on IISExpress over local network通过本地网络访问在 IIS Express 上运行的 Web API
【发布时间】:2018-05-14 09:19:09
【问题描述】:

我正在本地运行一个 WebAPI 项目,我想从连接在同一网络上的移动设备访问该项目。

我已经尝试了here 的所有步骤(tower 是我的主机名),但它不起作用:

There are three changes you might need to make.

Tell IIS Express itself to bind to all ip addresses and hostnames. In your .config file. Typically:
VS 2015: $(solutionDir)\.vs\config\applicationhost.config

Find your site's binding element, and add

    <binding protocol="http" bindingInformation="*:8080:tower" />

Setup the bit of Windows called 'http.sys'. As an administrator, run the command:
    netsh http add urlacl url=http://tower:8080/ user=everyone

Allow IIS Express through Windows firewall.
Start / Windows Firewall with Advanced Security / Inbound Rules / New Rule...

Program %ProgramFiles%\IIS Express\iisexpress.exe
OR Port 8080 TCP

本地一切正常:

但是在移动设备上 - 我收到一个错误:

tower's server DNS address could not be found.

ERR_NAME_NOT_RESOLVED

有人知道为什么会发生这种情况吗?我错过了一些明显的事情吗?

【问题讨论】:

  • 这与您的 IIS 设置无关。无论您的移动设备使用哪个DNS服务器,它都无法解析tower
  • 我需要在路由器上添加映射或类似的东西吗?
  • 可能,但鉴于这与编程无关,您真的应该在 serverfault.com

标签: asp.net iis asp.net-web-api iis-express


【解决方案1】:

这很可能意味着“塔”没有 DNS 对应关系,因此您需要使用 IP 地址或添加正确的 DNS 条目。

【讨论】:

  • 当我尝试 IP 地址时 - 我得到:错误的请求 - 无效的主机名
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-07-08
  • 2018-11-16
  • 1970-01-01
  • 2015-01-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多