<分区>
<分区>
我正在尝试构建一个使用 HTTPS 连接的 .NET Core 服务器。
我使用 dotnet dev-certs
工具创建了一个自签名证书,并且
像这样设置 Kestrel:
return WebHost.CreateDefaultBuilder(args)
.UseKestrel(options =>
{
options.Listen(IPAddress.Loopback, 5000, lisOpt => lisOpt.UseHttps("myCert.pfx", "test"));
})
.UseStartup<Startup>()
.Build();
但是当我尝试与我的客户端连接时,我不断收到此异常:
fail: Microsoft.AspNetCore.Server.Kestrel[0]
Uncaught exception from the OnConnectionAsync method of an IConnectionAdapter.
System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate
--- End of inner exception stack trace ---
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Security.SslState.ThrowIfExceptional()
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__50_2(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionAdapter.InnerOnConnectionAsync(ConnectionAdapterContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.FrameConnection.ApplyConnectionAdaptersAsync()
fail: Microsoft.AspNetCore.Server.Kestrel[0]
Uncaught exception from the OnConnectionAsync method of an IConnectionAdapter.
System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate
--- End of inner exception stack trace ---
我做错了什么?
最佳答案
这显然是因为我的客户端将请求发送到 127.0.0.1 而不是“localhost”。
关于ssl - .NET Core 在处理 HTTPS 证书时出现未知错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55317637/
相关文章:
asp.net-core - Azure,错误 403 - 禁止 : Client Certificate Required
ios - 在 iPhone 模拟器上成功安装证书后,在访问我的 Web 服务时仍然出现 SSL 错误
azure - 在azure应用程序服务上公开TLS/SSL服务器
ssl - 玩 WS SSL acceptAnyCertificate=true 问题
windows - 访问 nginx 后面的 Windows Admin Center
.NET core 3.0 和 MS Office Interop