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

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

我只从 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 程序,它解决了这个问题。 enter image description here

其次。如果您有 Kaspersky 防病毒软件,它可能不信任自签名证书并阻止到 localhost 的 https 连接。您必须在 «Settings > Advanced > Network» 选项卡的设置中忽略 localhost 域。

关于c# - .NET Core SSL - 模板仅在浏览器中显示 PR_CONNECT_RESET_ERROR (Firefox),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57284584/

相关文章:

c# - 如何在 C# 中检查 MySQL 连接状态

c# - 在 EF 上下文中使用 appsettings.json 配置

java - 使用 ssl : sending certificate file from client 的服务器端身份验证

.htaccess - 如何删除https

c# - 离开 Activity 去另一个 Activity 时,Xamarin Android Finalizer 没有被调用

c# - NLog v2 中的 AsyncWrapper 和 BufferingWrapper 有什么区别?

c# - 如何从 .NET Core 2.1/2.2 创建 Windows 服务

c# - .net 核心中的 CPU 使用率(至少在 Windows 上)

apache - SSL 证书 - 我需要更多的子域吗?

c# - 使用阅读器将列输入到 csv 文件中