首页 > 解决方案 > 无法在 Windows 的 Visual Studio 代码中启动红隼

问题描述

这是我在做 dotnet run 时遇到的问题

暴击: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, 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, 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 or is out of date. 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.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context) 在 Microsoft.AspNetCore.Server.Kestrel.Core 的 Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)。 Internal.AddressBinder.BindAsync(IServerAddressesFeature 地址,KestrelServerOptions serverOptions,ILogger 记录器,Func 2 createBinding) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication1 应用程序,CancellationToken cancelToken)
在 Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancelToken) 在 Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancelToken) 在 Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) 在 Microsoft。 Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host) at Microsoft.AspNetCore.Components.Web.DevServer.Commands.ServeCommand.Execute() at Microsoft.Extensions .CommandLineUtils.CommandLineApplication.Execute(String[] args) 在 Microsoft.AspNetCore.Components.WebAssembly.DevServer.Program.Main(String[] args)

标签: .net.net-core

解决方案


创建开发者证书

dotnet dev-certs https

如果您在 Mac 上,请信任证书

dotnet dev-certs https --trust

进一步阅读


推荐阅读