Dotnet Core 2.1: Enable Https/SSL locally

As every developer wants to replicate local web development set up as per production environment as much as possible.

  1. Download and Install .Net Core 2.1 from this site.
  2. Create new .Net core 2.1 web app
  3. Use following commands to install certificates locally
  4. dotnet dev-certs https --help
    dotnet dev-certs https --trust

  5. Read pop up and click yes to install certificate from localhost.
  6. Run your app, You will notice that your app is running on https locally.
  7. By default HTTPS redirection is included in ASP.NET Core, and in Production it’ll use HTTP Strict Transport Security (HSTS) as well, avoiding any initial insecure calls.
    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  8. public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    if (env.IsDevelopment())



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s