how to configure ssl cert in asp.net core?

mc 5,426 Reputation points
2023-04-01T06:02:37.9266667+00:00

I have cert fullchain.pem and private.pem

builder.WebHost.ConfigureKestrel(options =>

{

options.Listen(IPAddress.Loopback, 80, listenOptions => {

var path = builder.Environment.ContentRootPath + "wwwroot\\pem\\fullchain1.pem";

listenOptions.UseHttps(path, "my password");

});

});

but it tell me the password of the cert is not right,why?

I want to use it in IIS!

thank you.

Developer technologies ASP.NET ASP.NET Core
0 comments No comments
{count} votes

Accepted answer
  1. Lex Li (Microsoft) 6,037 Reputation points Microsoft Employee
    2023-04-01T08:41:34.4666667+00:00

    If your final setup is to host this ASP.NET Core web app on IIS, then please roll back all the changes you made in ConfigureKestrel as they are not needed.

    Instead, when you create the web site on IIS to map to your published artifacts, add an HTTPS binding to the site and select the desired server certificate.

    Since you have the certificate and private key in the non-Windows native format, you need to use a tool like OpenSSL to combine them and save to a .PFX file. Then that .PFX can be imported in IIS Manager. You might read mypost for more details.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.