c# - 尝试远程访问 API
问题描述
我正在尝试远程访问我的 api,但它没有连接
API 使用 .net 核心,我用 iis-express 运行它
我通过以下步骤在防火墙上打开了端口以允许从远程设备访问:
netsh http add urlacl url=http://192.168.1.42:58938/ user=everyone
netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=private remoteip=localsubnet action=allow
在applicationhost.config
我添加
<bindings>
<binding protocol="http" bindingInformation="*:58938:localhost" />
<binding protocol="http" bindingInformation="*:58938:192.168.1.3" />
</bindings>
并在launchSettings.json
我添加了这样的应用程序网址:
"iisSettings": {
"windowsAuthentication": false,
// "anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58938",
"sslPort": 0
}
}
我希望被允许从同一网络上的另一台设备访问我的 API,但我没有