学无先后,达者为师

网站首页 编程语言 正文

.NET 6 ‘Unable to configure HTTPS endpoint...

作者:Morris_ 更新时间: 2022-04-12 编程语言

Mac M1
.NET 6

Exception has occurred: CLR/System.InvalidOperationException “System.InvalidOperationException”类型的未经处理的异常在 System.Private.CoreLib.dll 中发生 : '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'.

具体报错如下:

Exception has occurred: CLR/System.InvalidOperationException
“System.InvalidOperationException”类型的未经处理的异常在 System.Private.CoreLib.dll 中发生 : '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.'
   在 Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions)
   在 Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)
   在 Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.d__2.MoveNext()
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   在 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   在 Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.d__0.MoveNext()
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   在 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   在 Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.d__33.MoveNext()
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   在 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   在 Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.d__30`1.MoveNext()
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Microsoft.AspNetCore.Hosting.GenericWebHostService.d__37.MoveNext()
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 Microsoft.Extensions.Hosting.Internal.Host.d__12.MoveNext()
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   在 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   在 Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.d__4.MoveNext()
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.d__4.MoveNext()
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   在 Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   在 TaskSystem.Program.Main(String[] args) 在 /Users/morris/Desktop/net5.0/TaskSystem/Program.cs 中: 第 16 行

需要将 .launchSettings.json 文件中的 applicationUrl 由 https 改为 http
在这里插入图片描述
有没有其他的解决方法,个人感觉这个解决方案不成熟,为什么不能使用HTTPS,是不是需要在其他什么配置里改什么配置?

原文链接:https://blog.csdn.net/Morris_/article/details/123812193

栏目分类
最近更新