首页 > 解决方案 > 本地网络中 IIS Express 上的主机名无效

问题描述

当我从 Visual Studio 启动 IIS-Express 时,我可以连接到我的网站并且一切正常。我想让我的网站可以从本地网络访问,所以我尝试了以下方法:

以管理员身份启动 Visual Studio(2019 社区版)

更改了:launchSettings.json

    {
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:1313/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "Skilliam": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:1313/"
    }
  }
}

应用程序主机配置

     <site name="WebSite1" id="1" serverAutoStart="true">
            <application path="/">
                <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
            </application>
            <bindings>      
                <binding protocol="http" bindingInformation="*:1313:localhost" />               
                <binding protocol="http" bindingInformation="*:1313:*" />
            </bindings>
        </site>

防火墙

在此处输入图像描述

在所有这些更改之后,当我尝试从我的网络中的不同设备连接时,我仍然得到“无效的主机名”。

标签: visual-studioasp.net-coreiis-express

解决方案


推荐阅读