我只从 VS 2017 模板对话框创建了一个 .NET Core Web 应用程序,并打开了“为 HTTPS 配置”。
我用过
dotnet dev-certs https --trust
并确认提示。我通过 MMC 检查了本地主机证书是否存在于 CurrentUser/My 中。
当我现在运行应用程序时,Firefox 只显示我(我不知道确切的英文翻译)
There was an error connecting to https//localhost:44371 PR_CONNECT_RESET_ERROR
Chrome 也显示以下错误,
ERR_CONNECTION_RESET
我也禁用了 Windows 防火墙,但结果是一样的。
当我在项目调试属性中取消勾选启用 SSL 时,站点显示良好但没有 HTTPS。
谁知道哪里出了问题,或者在 Github 的什么地方可以找到查找证书的代码?
更新 1:
我从使用 IIS Express 的 Visual Studio (2017) 启动应用程序切换到 Kestrel,这会打开控制台窗口并告诉我更多信息:
info: Microsoft.AspNetCore.Server.Kestrel[20]
Connection id "0HLOLGRVN8U0U" request processing ended abnormally.
System.IO.IOException: The decryption operation failed, see inner exception. ---
> System.ComponentModel.Win32Exception: Beim Verarbeiten des Zertifikats ist ein
unbekannter Fehler aufgetreten
--- End of inner exception stack trace ---
at System.Net.Security.SslStreamInternal.ReadAsyncInternal[TReadAdapter](TRea
dAdapter adapter, Memory`1 buffer)
at Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal.AdaptedPipeline.
ReadInputAsync(Stream stream)
at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
at System.IO.Pipelines.Pipe.GetReadAsyncResult()
at System.IO.Pipelines.Pipe.DefaultPipeReader.GetResult(Int16 token)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.Proces
sRequests[TContext](IHttpApplication`1 application)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.Proces
sRequestsAsync[TContext](IHttpApplication`1 application)
System.ComponentModel.Win32Exception: Beim Verarbeiten des Zertifikats ist ein unbekannter Fehler aufgetreten
已翻译
System.ComponentModel.Win32Exception: An unknown error occured while processing the certificate
在 Kestrel 下,Firefox 至少会打开我可以信任自签名证书的页面并显示该页面。 (但现在在不同的端口 5001 用于 https 和 5000 用于 http)。 Chrome 不会要求信任证书,只是继续按预期工作。
对我来说,证书和/或 IIS Express 似乎有问题。
找到 that one尽管这是一个不同的问题。
最佳答案
还有两个案例。
首先。我已经尝试了 Microsoft 提供的所有故障排除建议,但没有任何帮助。 然后我修复了 IIS Express 程序,它解决了这个问题。
其次。如果您有 Kaspersky 防病毒软件,它可能不信任自签名证书并阻止到 localhost
的 https 连接。您必须在 «Settings > Advanced > Network» 选项卡的设置中忽略 localhost
域。
关于c# - .NET Core SSL - 模板仅在浏览器中显示 PR_CONNECT_RESET_ERROR (Firefox),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57284584/