0

I have been unable to successfully use HTTPS with Kestrel in .NET Core 6. App can run, however on hitting any of the endpoints with "https:", the error "The credentials supplied to the package were not recognized" appears.

enter image description here

Here is how I currently "bind" my certificate.

IHost host = Host.CreateDefaultBuilder(args)
.UseWindowsService()
.ConfigureWebHostDefaults(webBuilder => { 
    webBuilder.UseStartup<Startup>();
    webBuilder.UseKestrel(options =>
    {
        var pfxFilePath = "C:\\test.pfx;
        var password = "hello";

        options.ListenAnyIP(5000);
        options.ListenAnyIP(5001, listOpt =>
        {
            listOpt.UseHttps(pfxFilePath, password);
        }); 
    });
}).Build();

I have tried various ways to access the cert (that is also already installed) via Certificate Store, but to no avail as well.

On accessing "https://localhost:5001/abc", the errors will start appearing.

thebernardlim
  • 755
  • 2
  • 10
  • 23
  • This seems to be caused by lack of permissions, refer to this post, which may help you:https://stackoverflow.com/questions/40046916/how-to-grant-permission-to-user-on-certificate-private-key-using-powershell – Tupac Jan 20 '22 at 02:56
  • @thebernardlim Is this a known working pfx? – clamchoda Jul 15 '22 at 01:10

0 Answers0