更换端口号试一下。
查看官方文档
PS:
使用帮助命令 -h,可以指定启动配置文件: dotnet run --launch-profile xxx
例如下面的配置文件,假如我们要使用codes-test的配置,可以这样:dotnet run --launch-profile codes-test
学会看官方文档可以少走很多弯路。
{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:58970", "sslPort": 44395 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "codes": { "commandName": "Project", "launchBrowser": true, "applicationUrl": "https://localhost:5001;http://localhost:9000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "codes-test": { "commandName": "Project", "launchBrowser": true, "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } }