首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当'dotnet运行‘时无法启动Kestrel

当'dotnet运行‘时无法启动Kestrel
EN

Stack Overflow用户
提问于 2019-08-31 08:56:56
回答 1查看 4K关注 0票数 0

我最近删除了我电脑上记忆中的一个Wi。突然,所有的项目都失败了。

这是控制台输出

代码语言:javascript
复制
$ dotnet run
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using '/Users/user/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
crit: Microsoft.AspNetCore.Server.Kestrel[0]
      Unable to start Kestrel.
System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
   at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions)
   at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, KestrelServerOptions serverOptions, ILogger logger, Func`2 createBinding)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)

Unhandled Exception: System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
   at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions)
   at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, KestrelServerOptions serverOptions, ILogger logger, Func`2 createBinding)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at testing.Program.Main(String[] args) in 

我在Mac上使用了2019。.NET核心SDK和运行时版本:

代码语言:javascript
复制
dotnet --version
2.2.401

dotnet --list-sdks
2.2.401 [/usr/local/share/dotnet/sdk]

dotnet --list-runtimes
Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

我看了一些堆栈溢出的答案,他们认为这可能是证书问题。我尝试过使用dotnet dev-certs工具来解决问题,但它不起作用。另外,我遇到了一些奇怪的事情:

代码语言:javascript
复制
dotnet dev-certs https --check --verbose
No valid certificate found.

dotnet dev-certs https
A valid HTTPS certificate is already present.

dotnet dev-certs https --trust
Trusting the HTTPS development certificate was requested. If the certificate is not already trusted we will run the following command:
'sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain <<certificate>>'
This command might prompt you for your password to install the certificate on the system keychain.
A valid HTTPS certificate is already present.

dev-certs检查选项生成与创建新搜索的命令相矛盾的结果

dotnet-dev-certs版本是2.2.0

在我的密钥链中,没有本地主机的证书。然后,我尝试重新安装dotNET SDK和Visual,但也不起作用。

EN

回答 1

Stack Overflow用户

发布于 2021-04-18 21:29:31

我正在经历同样的问题,最后,我在命令提示符下完成了两件事情。

  1. dotnet certs https --干净
  2. dotnet certs https --信任

C:\Users\saifs>dotnet开发证书https -清洁HTTPS开发证书从机器.可能会显示提示符以确认某些证书的删除。

成功生成了https开发人员证书C:\Users\saifs>dotnet开发证书。

请求C:\Users\saifs>dotnet开发证书- https -信任HTTPS开发证书。如果证书以前不受信任,则将显示确认提示。在提示符上单击“是”以信任证书。有效的HTTPS证书已经存在。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57736568

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档