配置 IIS Express 以允许使用 public ip 的请求

Configure IIS Express to allow requests with public ip

我刚刚创建了一个新的 ASP.NET 核心 API 项目,当我像 localhost:50731 那样到达它时它运行完美,但是当我这样做时 83.11.58.141:50731 它无法到达。

我指示路由器端口桥接流量并且它有效(使用 WireShark 测试)。

我在更改 applicationhost.config 时看到了一些建议,但这对我不起作用。

这是我的:

        <bindings>
          <binding protocol="http" bindingInformation="*:50731:*" />
        </bindings>

我也试过没有最后一个 *,但结果相同。

我的解决方案是允许 Windows 防火墙中的端口。

Windows Defender > Advanced configuration > Output rules > New rule