我最近将 IDE 从 VS 2019 更改为 2022,并且在没有收到弹出消息的情况下无法成功调试 SSL 网站:
该项目配置为使用 SSL。为了避免浏览器中出现 SSL 警告,您可以选择信任 IIS Express 生成的自签名证书。您想要信任 IIS Express SSL 证书吗?
单击“是”后,会弹出以下消息:
将证书添加到受信任的根证书存储失败,并出现以下错误:访问被拒绝。
经过一些研究后,我在管理提示符下运行了以下命令:
dotnet dev-certs https --clean
dotnet dev-certs https --trust -v
Run Code Online (Sandbox Code Playgroud)
这导致了以下结果:
信任证书时发生错误:Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException:访问被拒绝。在Internal.Cryptography.Pal.StorePal.Add(ICertificatePal证书)在System.Security.Cryptography.X509Certificates.X509Store.Add(X509Certificate2证书)在Microsoft.AspNetCore.Certificates.Generation.WindowsCertificateManager.TrustCertificateCore(X509Certificate2证书)在Microsoft.AspNetCore .Certificates.Generation.CertificateManager.TrustCertificate(X509Certificate2 证书)。信任 HTTPS 开发人员证书时出错。
到目前为止,我已尝试将本地主机证书直接导入受信任的根证书颁发机构,更改 C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys 文件夹的权限,卸载 IIS Express 并修复,以及卸载并重新安装 VS 2022。到目前为止没有任何效果,不知道从这里开始尝试什么?