从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/"
}
}
}
applicationhost.config
<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>
防火墙
所有这些更改之后,当尝试从网络中的不同设备进行连接时,我仍然会收到“无效的主机名”。