无法信任 ASP.NET Core 中的本地 HTTPS 证书 [英] Trouble trusting local HTTPs certificate in ASP.NET Core

查看:38
本文介绍了无法信任 ASP.NET Core 中的本地 HTTPS 证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照在线教程创建一个 ASP.NET Core Web 应用程序.我关注了所有内容,但无法信任本地 HTTPS 证书.

I am following an online tutorial to create an ASP.NET Core Web application. I followed everything but had trouble with trusting the local HTTPS certificate.

当我第一次运行应用程序时,我收到一条错误消息:访问控制列表 (acl) 结构无效"

When I first run the application, I got an error saying: "the access control list (acl) structure is invalid"

我尝试用谷歌搜索此错误,但找不到与我的 ASP.NET 应用程序相关的任何内容,在清理解决方案后我不再收到此错误.

I tried googling this error but couldn't find anything related to my ASP.NET application, after cleaning the solution I didn't get this error any longer.

但我无法使用 HTTPS 在浏览器中运行我的应用程序,因为它总是说:这个网站不安全"

But I was unable to run my application in browser using HTTPS as it always says: "This site is not secure"

我尝试使用以下命令使用 CMD 信任证书:

I tried to trust certificate using CMD using this command:

dotnet dev-certs https --trust

它应该向我显示信任证书的提示,但它说信任 HTTPS 开发人员证书时出错"并且应用程序在浏览器上以不安全模式运行.

It should show me a prompt to trust the certificate but it says "there was an error trusting the HTTPS developer certificate" and the application runs in an unsafe mode on the browser.

有人可以帮我在本地环境中使用 HTTPS 运行我的应用程序吗?任何帮助将不胜感激.谢谢

Can someone please help me run my application with HTTPS on my local environment? Any help will be greatly appreciated. Thanks

推荐答案

这似乎是 ASP.NET Core 2.1 中的一个错误:

This seems to be a bug in ASP.NET Core 2.1:

您需要做的是从您的证书管理器中移动您添加的证书.

what you need to do is go move your added certificates from your certificate manager.

进入开始菜单> 键入Ctrl + R"键入certlm.msc",这将打开您的证书管理器.

go to start menu > Type "Ctrl + R" type "certlm.msc", this will open your certificate manager.

转到个人/证书

你会在那里找到一个名为localhost的证书.

you will find a certificate named "localhost there.

将其移至受信任的根证书颁发机构/证书"

Move that to "Trusted Root Certification Authorities/Certificates"

再次运行项目,它应该可以工作了.

run the project again, and it should work.

希望这会有所帮助.

这篇关于无法信任 ASP.NET Core 中的本地 HTTPS 证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆