【问题标题】:DotNet not valid certificate found发现 DotNet 无效证书
【发布时间】:2021-03-23 18:07:39
【问题描述】:

我已经多次看到这个问题,但没有一个答案对我有用。 我的 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.

【问题讨论】:

    标签: c# .net-core https


    【解决方案1】:

    我找到了解决方案。 我不得不手动删除所有证书,因为 dotnet dev-certs https --clean 没有删除所有证书

    如果您遇到此问题,请从以下位置删除所有具有 友好名称 ASP.NET Core...localhost 证书:

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

    更多信息here

    【讨论】:

    • 试过这个,但仍然没有运气。运行--check时仍然说没有有效证书
    • @DavidPeterson 您在证书存储中是否有任何 DotNet 证书?如果您不确定如何检查,请告诉我
    • 我过快地阅读了答案,并意识到我错过了您还需要检查 个人 证书的地方。在那里找到更多证书后,我能够解决这个问题。我忘了我写了这个,否则我会更新它。
    • 在 Mac Os 中,我删除了系统选项卡中的 localhost 证书。
    • 非常感谢@sudherson 分享小费!
    猜你喜欢
    • 1970-01-01
    • 2014-05-02
    • 1970-01-01
    • 1970-01-01
    • 2022-07-29
    • 1970-01-01
    • 1970-01-01
    • 2013-01-07
    • 2019-08-04
    相关资源
    最近更新 更多