使用“dotnet dev-certs”工具导出 https 证书失败

Kev*_*ton 9 dotnet-dev-certs

我正在尝试使用“dotnet dev-certs”工具导出 https 证书以包含在 Docker 映像中。现在我正在使用:

dotnet dev-certs https -v -ep $(HOME)\.aspnet\https -p <password>
Run Code Online (Sandbox Code Playgroud)

我得到错误:

Exporting the certificate including the private key.
Writing exported certificate to path 'xxx\.aspnet\https'.
Failed writing the certificate to the target path
Exception message: Access to the path 'xxx\.aspnet\https' is denied.
An error ocurred exporting the certificate.
Exception message: Access to the path 'xxx\.aspnet\https' is denied.
There was an error exporting HTTPS developer certificate to a file.
Run Code Online (Sandbox Code Playgroud)

我看到的问题是,无论我提供什么路径来导出证书,我都会收到相同的“访问路径被拒绝”错误。我错过了什么?我知道在很多地方都建议了这个命令。但我似乎无法让它发挥作用。

谢谢你。

Dan*_*iel 5

导出路径应指定文件,而不是目录。这解决了我在 Mac 上的问题:

dotnet dev-certs https -v -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p <password>

  • 这并没有解决我的问题 (2认同)
  • 在 Windows 10 上以管理员身份使用 powershell 进行测试和工作。`dotnet dev-certs https -ep ${home}\.aspnet\https\aspnet.pfx -p &lt;密码&gt;` (2认同)