Ger*_*rit 5 .net c# asp.net-core asp.net-core-6.0
我昨天从 .Net 5 更新到 .Net 6,现在我的项目无法从 .Net 启动dotnet run。然后我得到错误:
Building...
warn: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[5]
The ASP.NET Core developer certificate is in an invalid state. To fix this issue, run the following commands 'dotnet dev-certs https --clean' and 'dotnet dev-certs https' to remove all existing ASP.NET Core development certificates and create a new untrusted developer certificate. On macOS or Windows, use 'dotnet dev-certs https --trust' to trust the new certificate.
fail: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[4]
The ASP.NET Core developer certificate is in an invalid state. To fix this issue, run the following commands 'dotnet dev-certs https --clean' and 'dotnet dev-certs https' to remove all existing ASP.NET Core development certificates and create a new untrusted developer certificate. On macOS or Windows, use 'dotnet dev-certs https --trust' to trust the new certificate.
Run Code Online (Sandbox Code Playgroud)
我已尝试了所有删除/清理并再次创建的步骤,但这没有帮助。服务器启动,但无法从浏览器建立连接。
我使用 Mac 操作系统 11
有人有想法吗?
小智 5
添加到项目文件的元素<UseAppHost>false</UseAppHost>下。<PropertyGroup>要了解有关此(希望)临时问题的更多信息,请查看此处
引用链接
要解决此问题,可以将项目文件中的 MSBuild 属性设置为 false,例如:
<PropertyGroup>
<UseAppHost>false</UseAppHost>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
您还可以将此属性作为 dotnet run 命令本身的一部分传递:
dotnet run -p:UseAppHost=false