.NET Core SSL-模板仅在浏览器中显示PR_CONNECT_RESET_ERROR(Firefox)

mon*_*nty 5 c# ssl-certificate iis-express .net-core .net-core-2.2

我仅在VS 2017模板对话框中启用了“配置HTTPS”,从而创建了.NET Core Web应用程序。

我用了

dotnet dev-certs https --trust
Run Code Online (Sandbox Code Playgroud)

并确认提示。我用MMC检查了CurrentUser / My中是否存在本地主机证书。

当我现在运行该应用程序时,Firefox仅向我显示(我不知道确切的英语翻译)

连接到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)
Run Code Online (Sandbox Code Playgroud)

System.ComponentModel.Win32Exception:Beim Verarbeiten des Zertifikats ist ein unbekannter Fehler aufgetreten

被翻译

System.ComponentModel.Win32Exception:处理证书时发生未知错误

在Kestrel下,Firefox至少会打开一个页面,在该页面中我可以信任自签名证书,并且该页面会显示出来。(但现在位于https的不同端口5001和http的不同端口上)。Chrome不会要求您信任证书,只是会按预期运行。

对我来说,证书和/或IIS Express似乎有问题。


发现一个,虽然这是怎样的一个不同的问题。

Alw*_*ing 1

在 Firefox 中,about:config您是否在设置中包含了端口 44371 network.security.ports.banned.override

搜索network.security.ports.banned.override。如果不存在,请使用“新建”>“字符串”创建它,并将值定义为以逗号分隔的端口号列表,例如:80,443,44371

参考:network.security.ports.banned.override

===编辑===

Firefox 中about:config还有最小/最大 TLS 版本选项。当 Firefox 不提供“可接受的”版本时,这些可能会限制 Firefox 连接到 https:// 网站的方式:

  • security.tls.version.max
    • 默认值:3(最高 Firefox 版本 60)
    • 默认值:4(Firefox 61 及更高版本)。
  • security.tls.version.min
    • 默认值:1。

在哪里:

  • 1 = TLS 1.0
  • 2 = TLS 1.1
  • 3 = TLS 1.2
  • 4 = TLS 1.3(Firefox 61 中的新增功能)

参考:security.tls.版本。*

您可以使用 OpenSSL 命令行工具并要求其使用单个 TLS 版本来测试 IIS 和 IIS Express 能够提供哪些版本的 SSL/TLS,例如:

  • TLS 1.0:openssl s_client -debug -host 127.0.0.1 -port 44371 -tls1
  • TLS 1.1:openssl s_client -debug -host 127.0.0.1 -port 44371 -tls1_1
  • TLS 1.2:openssl s_client -debug -host 127.0.0.1 -port 44371 -tls1_2