【问题标题】:.NET Core SSL - template shows in browser only PR_CONNECT_RESET_ERROR (Firefox).NET Core SSL - 模板仅在浏览器中显示 PR_CONNECT_RESET_ERROR (Firefox)
【发布时间】:2019-12-08 14:36:26
【问题描述】:

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

我用过

dotnet dev-certs https --trust

并确认提示。我向 MMC 检查了 localhost 证书是否存在于 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)

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

已翻译

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

在 Kestrel Firefox 下,至少会显示我可以信任自签名证书的页面并显示该页面。 (但现在在不同的端口 5001 用于 https 和 5000 用于 http)。 Chrome 不要求信任证书,只是按预期工作。

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


找到that one,虽然这是一个不同的问题。

【问题讨论】:

  • 我认为你甚至不需要运行 dotnet dev--certs 的东西。它应该开箱即用。我从来没有运行过它,总是使用 https
  • 是的,dev-certs 命令以防万一没有本地主机 SSL 证书。由于我将它们全部删除(因为我正在尝试使用证书)我需要确保我有一个。
  • 当您在 IIS Express 上托管网站时,SSL Diag 可以揭示典型问题docs.jexusmanager.com/tutorials/ssl-diagnostics.html 当您直接在 Kestrel 上托管它时,您很可能需要在 Kestrel 中进行调试以了解问题所在。
  • 您找到解决方案了吗?我有同样的问题。

标签: c# .net-core ssl-certificate iis-express .net-core-2.2


【解决方案1】:

还有两个案例。

首先。我已经尝试了 Microsoft 的所有故障排除建议,但没有任何帮助。 然后我修复了 IIS Express 程序,它解决了这个问题。

第二。如果您有 Kaspersky 防病毒软件,它可能不信任自签名证书并阻止与 localhost 的 https 连接。您必须在«设置>高级>网络»选项卡的设置中忽略localhost域。

【讨论】:

【解决方案2】:

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

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

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

=== 编辑 ===

Firefox 的about:config 中还有最小/最大 TLS 版本选项。这些可能会限制 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.version.*

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

  • 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

【讨论】:

  • 定义值,关闭并重新打开 Firefox 以确保值被存储但没有更改/修复它。
【解决方案3】:

我尝试了从@shirhatti 重新创建开发证书的解决方案 https://github.com/dotnet/aspnetcore/issues/26437#issuecomment-723334864。 它为我解决了这个问题

【讨论】:

    猜你喜欢
    • 2017-07-06
    • 2012-02-13
    • 1970-01-01
    • 1970-01-01
    • 2018-02-01
    • 2018-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多