aut*_*ton 36 asp.net ssl-certificate visual-studio .net-core asp.net-core
创建 Web 项目时,Visual Studio 会自动生成 SSL 证书并提示您安装它。一切正常。
该证书现已过期,我不知道如何让它重新生成证书并重新开始该过程。我尝试localhost从证书存储中删除所有现有证书并删除 Secrets.json,但似乎没有什么可以强制它重新启动生成过程。
aut*_*ton 52
我终于弄明白了。
对于遇到此问题的其他人,解决此问题的步骤如下:
localhost必须在证书管理器中删除所有证书。它们可以在个人和受信任的根中找到\Users\[user]\AppData\Roaming\Microsoft\UserSecrets\dotnet dev-certs https --trust创建并安装一个新的,并提示信任此后它将再次起作用。
Ihd*_*ina 38
从Visual Studio 2022 >工具> Nuget 包管理器>包管理器控制台
当包管理器控制台显示出现在底部时,请键入以下命令
PM > dotnet dev-certs https --clean
//Cleaning HTTPS development certificates from the machine. A prompt might get displayed to confirm the removal of some of the certificates.
//HTTPS development certificates successfully removed from the machine.
PM > dotnet dev-certs https --trust
//Trusting the HTTPS development certificate was requested.A confirmation prompt will be displayed if the certificate was not previously trusted.Click yes on the prompt to trust the certificate.
//Successfully created and trusted a new HTTPS certificate.
PM > dotnet dev-certs https --check
//A valid certificate was found: C40087E6CA2F2A811F3BF78E3C5FE6BA8FA2XXXX - CN = localhost - Valid from 2023 - 01 - 27 23:21:10Z to 2024 - 01 - 27 23:21:10Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
//Run the command with both--check and --trust options to ensure that the certificate is not only valid but also trusted.
Run Code Online (Sandbox Code Playgroud)
详情请看这里
Ple*_*ebo 24
我花了几天时间试图解决这个问题,但上述答案都不适合我。在 Microsoft 管理控制台中搜索时,任何地方都不存在过期的证书。运行dotnet dev-certs https --clean和--trust命令后,我的浏览器使用的证书仍然过期。
对我来说,解决方案是导航到%APPDATA%\ASP.NET\https或C:\Users\{user}\AppData\Roaming\ASP.NET\https并删除那里的证书。他们应该有您的项目名称,即myproject.key和myproject.pem。删除这些文件,然后重建并运行您的项目。这应该会自动生成文件的新版本,并且浏览器应该会获取新证书。
感谢这篇文章提供了修复!
| 归档时间: |
|
| 查看次数: |
34321 次 |
| 最近记录: |