解决方案#
在 Visual Studio 中使用 IIS Express 运行项目弹出 [无法连接到 Web 服务器 “IIS Express”] 异常:
解决步骤:
- 关闭 Visual Studio
- 删除项目根目录中的 .vs目录
- 删除 C:\Users\Administrator\Documents\IISExpress(文档)下所有子目录,其中Administrator是为当前登录的用户名,需要根据自己的情况替换
- 重新用 Visual Studio 打开项目,用 IIS Express 启动项目
注意:
- 
iisSettings.iisExpress.applicationUrl不能配置0.0.0.0和*,如果需要绑定要局域网 IP 需要填写本机实际的局域网 IP,如果使用 Kestrel 启动,则可以直接配置为0.0.0.0和*,参考:{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:44372/", "sslPort": 0 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "XXW.IDCloud.Web": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "http://*:44372/" } } }