简体   繁体   English

如何使用新的 HTTPS 本地主机证书

[英]How can I use new HTTPS localhost certificate

I have a problem with HTTPS when I am running ( dotnet run ) my.NetCore application locally on Windows.当我在 Windows 上本地运行( dotnet run )my.NetCore 应用程序时,HTTPS 出现问题。 It was working till my localhost certificate expired…它一直工作到我的本地主机证书过期......

I clean up old certificates and generated the new one by我清理旧证书并通过

dotnet dev-certs https –clean
dotnet dev-certs https –trust

I've verified that everything was added to certmgr (Personal and Trusted certs), but I have the same problem.我已验证所有内容都已添加到 certmgr(个人和受信任的证书)中,但我遇到了同样的问题。 It is keep trying to use old certificate which expired.它一直在尝试使用过期的旧证书。 I do not know why it is trying to use old “localhost” certificate after clean up certs…我不知道为什么它在清理证书后尝试使用旧的“localhost”证书……

Do you have any idea what should I do?.你知道我该怎么做吗?

Thank you, Błażej谢谢你,Błażej

If not helps recreate cert by commands:如果没有帮助通过命令重新创建证书:

dotnet dev-certs https ––clean
dotnet dev-certs https ––trust

Clean all private keys from folder:清除文件夹中的所有私钥:

C:\Users\{User}\AppData\Roaming\ASP.NET\Https

You need to use two hyphens.您需要使用两个连字符。 The flag is -t or --trust , not –trust so the following should work:该标志是-t--trust ,而不是–trust所以以下应该工作:

dotnet dev-certs https --trust

You can also run the help command to see more info您还可以运行帮助命令以查看更多信息

dotnet dev-certs https --help

dev-certs https 帮助输出

See Also : How to run dotnet dev-certs https --trust ?另请参阅如何运行dotnet dev-certs https --trust

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM