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.

摘要:
在CMD上运行dotnetdev-certshttps--clean,然后运行dotnet-dev-certshttps-t。现在,您可以使用以下命令检查证书dotnetdevcertshttps--check if
 

PS E:C#coremvcmvctest> dotnet run
正在生成...
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 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'.
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.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.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 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, 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(IEnumerable`1 listenOptions, AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at mvctest.Program.Main(String[] args) in E:C#coremvcmvctestProgram.cs:line 16

 

解决方案:

1.打开certmgr.msc(当前用户)

2. 删除所有本地主机证书:

- 当前用户信任的根证书颁发机构/证书

- 个人/证书,,,删除所有localhost  再执行 dotnet dev-certs https --trust

 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.第1张

以下方案未成功

dotnet dev-certs https --trust
--------------------------------------------------------------------
关闭浏览器,以免它们缓存证书,因为这会导致其他问题。

在CMD上运行

dotnet dev-certs https --clean
然后跑

dotnet dev-certs https -t
现在,您可以使用以下命令检查证书

dotnet dev-certs https --check
如果这没有返回任何我认为意味着一切都很好。 

免责声明:文章转载自《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.》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇使用docker部署springboot应用Windows上使用Git托管代码到Coding下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

解决cookie跨域访问

如果用户在登录(记录用户上下文信息)后在浏览器客户端上写入cookie,则只能访问与创建cookie的页面相同目录或创建cookie页面的子目录中的网页。这是因为cookie可以由其路径下的页面访问。然后,如果您想在域a中生成一个可以被域a和域B访问的cookie,则需要将cookie的域设置为.test.com;...

VirtualBox虚拟机下Windows登录密码破解方法(阿里云推荐码:1WFZ0V,立享9折!)

过去两年虚拟机的发展给开发者带来了极大的便利。要安装新环境,只需从其他人复制虚拟机文件即可。我以前在Ubuntu下工作,Windows偶尔也会使用它。所以我在Ubuntu VirtualBox下安装了Windows7。两天前,我在MacAir下打开了VirtualBox并启动了Win7虚拟机。在Win7登录界面输入密码后,系统提示我密码不正确。我只能在最初的...

ftp命令

ftp命令是标准文件传输协议的用户界面。Ftp是在TCP/IP网络上的计算机之间传输文件的一种简单有效的方法。它允许用户传输ASCII文件和二进制文件。用户可以在目录中上下移动,列出目录内容,将文件从远程计算机复制到本地计算机,并将文件从本地计算机传输到远程系统。它用于确定用户可以对要传输的文件进行何种访问。用户显然需要知道进行ftp会话的计算机的名称或IP...

Visual studio之C#实现数字输入模拟键盘

所以我想自己实现软键盘。这篇文章是来做记录的。在Load event表单中,添加所有标签控件的click event mybutton _ clicked,privatevoidlazerctrl _ Load{//注册键盘,单击事件keyb1。单击+=newEventHandler;keyb2。单击+=newEventHandler,keyb3。单击++=...

ERROR [IM002] [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序

使用C#生成应用程序以及读取和写入dbfs时,打开方法error[IM002][Microsoft][ODBC驱动程序管理器]中发生错误。找不到数据源名称,也未指定默认驱动程序。这个程序以前使用得很好。升级和修改后,在测试中发现了问题。为了追踪来源,我曾经是一个32位操作系统。现在我安装了一个win764位操作系统。从控制面板到管理工具再到ODBC驱动程序,...

WPF 制作圆角按钮

在程序对应坐置插入以下代码,或是先拖一个按钮控件到窗体中,再替换对应的代码。...