Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found

后端 未结 13 2038
南旧
南旧 2021-01-30 19:46

I am working on a fabric application where I have configured HTTPS. It is throwing an exception though I have a valid installed certificate.

相关标签:
13条回答
  • 2021-01-30 20:17

    For me the problem was resolved by running:

    1. dotnet dev-certs https --clean
    2. dotnet dev-certs https --verbose

    0 讨论(0)
  • 2021-01-30 20:17

    If you want to work with an environment that is not Development, don't forget that user secrets are only added automatically when env is Development.

    You can use the AddUserSecrets methods to resolve this :

    public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.ConfigureAppConfiguration((hostingContext, builder) =>
                    {
                        var env = hostingContext.HostingEnvironment;
                        if (env.IsEnvironment("Local"))
                        {
                            builder.AddUserSecrets<Startup>();
                        }
                    })
                    .UseStartup<Startup>();
                });
    

    see also : https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-3.1&tabs=windows#access-a-secret

    0 讨论(0)
  • 2021-01-30 20:19

    I hope a separate answer is ok since I don't have the rep to comment. Here's the solution I found, which I didn't see mentioned anywhere else on SO or other sites. This is specific to the Windows certificate manager, not sure if other OSes run into similar issues.

    What I Tried from Other Answers

    dotnet dev-certs https arguments

    I tried various combinations of dotnet dev-certs https with --trust, --clean --verbose (which didn't seem to actually log any additional info), and --check (which never found a certificate)

    certmgr.msc

    As suggested in other answers, I deleted all localhost certificates under Trusted Root Certification Authorities\Certificates in certmgr.msc in conjunction with dotnet dev-certs https --clean

    Solution

    Eventually I realized that certmgr.msc also showed a number of localhost certificates under Personal\Certificates, in addition to those under Trusted Root Certification Authorities\Certificates. It turned out that these all needed to be deleted.

    Then running dotnet dev-certs https -t a single time created and trusted a new development certificate.

    I verified by debugging an ASP.NET Core App. Another way to verify is by running dotnet dev-certs https --check --verbose

    0 讨论(0)
  • 2021-01-30 20:20

    I run this on my command prompt. btw I am using Window 10 dotnet dev-certs https dotnet dev-certs https -t

    0 讨论(0)
  • 2021-01-30 20:23

    These instructions from this blog worked for me

    1. dotnet dev-certs https --clean
    2. dotnet dev-certs https -t
    3. Restart VS
    0 讨论(0)
  • 2021-01-30 20:28

    I had a similar (but not exactly the same) problem.
    With 2.1 you have to configure your certificate.
    I do this now completely in appsettings.json.
    You can find my posting here:
    Configure self hosting Kestrel App with certificate for https (internet web server)

    Only have a look to the solution...

    0 讨论(0)
提交回复
热议问题