I have asp.net core application. It works well but we are going to use https then. What I have to do? Steps in local development and in production?

For example, in local the url is http://localhost:12345; but we want https://localhost:12345


In production I am talking about hosting in IIS

  • Do you have a https cert for localhost? letsencrypt.org/docs/certificates-for-localhost – mjwills Jun 6 at 1:04
  • I guess no. But does every developer need to have his own https cert on his machine? Or a common one? – Bigeyes Jun 6 at 1:08
  • 1
    Do you mean you need Enforce HTTPS in ASP.NET Core? – Xing Zou Jun 6 at 2:24
  • localhost https comes out of the box. if you mean while hosting, append the question with more information on where you are hosting – Neville Nazerane Jun 6 at 4:27
  • @NevilleNazerane, I am not sure your comment. In local dev, we don't use IIS Express, it is .net core + angular project. In production we host it on IIS I guess. – Bigeyes Jun 6 at 10:18

In local development, you don't have to change anything if you're using IIS to expose your service.

In IIS either

  • check 'require SSL' for your site under 'SSL settings'
  • or if you want to redirect http traffic to https; do NOT check 'require SSL', but add a redirect rule

Like so

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
  <match url="(.*)" />
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
  • Do we have to install some cert etc, could you please share some images(snapshot)? – Bigeyes Jun 7 at 11:14
  • I can't beat the Microsoft docs for that: knowledge.digicert.com/solution/SO14335.html – Jesse de Wit Jun 7 at 11:20
  • On your development machine you can simply use http. No need to test against a https service. – Jesse de Wit Jun 7 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.