DotNet 未找到有效证书

2024-03-10

我已经多次看到这个问题,但没有一个答案对我有用。 我的 DotNet Core 应用程序失败

代码:

    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

错误:

System.InvalidOperationException
  HResult=0x80131509
  Message=Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
  Source=Microsoft.AspNetCore.Server.Kestrel.Core

This exception was originally thrown at this call stack:
[External Code]
AccionesWeb.Program.Main(string[]) in Program.cs

当我尝试创建证书时,它创建它没有问题,但随后它说not found

PS ...> dotnet dev-certs https -t
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.
The HTTPS developer certificate was generated successfully.

PS ...> dotnet dev-certs https -c
No valid certificate found.

我找到了解决方案。 我必须手动删除所有证书,因为dotnet dev-certs https --clean并没有将它们全部删除

如果您遇到此问题,请删除所有localhost证书与友好名称 ASP.NET Core... from:

  • 当前用户 > 个人 > 证书
  • 当前用户 > 受信任的根证书颁发机构 > 证书

更多信息在

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

DotNet 未找到有效证书 的相关文章

随机推荐