【问题标题】:How do I resolve Kestrel/HTTPS Error for ASP.NET MVC Core 2.2?如何解决 ASP.NET MVC Core 2.2 的 Kestrel/HTTPS 错误?
【发布时间】:2019-05-09 15:36:09
【问题描述】:

我正在尝试通过 Visual Studio 代码在 Mac 上运行 ASP.NET MVC Web 应用程序并收到以下错误:-

使用来自 '/Users/dhumes/development/aspnetdev/aspnetwebapp/Properties/launchSettings.json' [Profile 'aspnetwebapp'] 的启动设置... 信息:Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] 用户配置文件可用。使用“/Users/dhumes/.aspnet/DataProtection-Keys”作为密钥存储库;密钥不会在静止时加密。 暴击:Microsoft.AspNetCore.Server.Kestrel[0] 无法启动 Kestrel。 System.InvalidOperationException:无法配置 HTTPS 端点。未指定服务器证书,并且找不到默认的开发人员证书。 要生成开发人员证书,请运行“dotnet dev-certs https”。要信任证书(仅限 Windows 和 macOS),请运行“dotnet dev-certs https --trust”。 有关配置 HTTPS 的更多信息,请参阅https://go.microsoft.com/fwlink/?linkid=848054。 在 Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action1 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, Func2 createBinding) 在 Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication1 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, Action1 configureOptions) 在 Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions) 在 Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext 上下文) 在 Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature 地址,KestrelServerOptions serverOptions,ILogger 记录器,Func2 createBinding) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication1 应用程序,CancellationToken cancelToken) 在 Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancelToken) 在 Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost 主机,CancellationToken 令牌,字符串 shutdownMessage) 在 Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost 主机,CancellationToken 令牌) 在 Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost 主机) 在 /Users/dhumes/development/aspnetdev/aspnetwebapp/Program.cs:line 17 中的 aspnetwebapp.Program.Main(String[] args)

【问题讨论】:

    标签: kestrel-http-server kestrel


    【解决方案1】:

    尝试运行

    dotnet dev-certs https --trust

    这将为 localhost 安装本地证书。

    【讨论】:

      猜你喜欢
      • 2019-09-21
      • 2019-10-10
      • 2018-11-28
      • 2018-03-02
      • 1970-01-01
      • 1970-01-01
      • 2019-10-30
      • 2018-02-20
      相关资源
      最近更新 更多