DEV Community

Michael Eustace
Michael Eustace

Posted on

2

How to generate a trusted local IIS certificate for .Net development

As a .Net developer, I often run .Net websites in a local IIS instance on my developer machine, and it can be useful to be able to serve the site over HTTPS.

To create a trusted, local, self-signed SSL certificate, follow these steps.

1. Generate the certificate

Open Powershell and enter the following command:

New-SelfSignedCertificate -DnsName "mysite.local" -CertStoreLocation "cert:\LocalMachine\My"
Enter fullscreen mode Exit fullscreen mode

2. Trust the certificate

We now need to ensure the certificate is trusted on the local machine, otherwise you'll get a certificate warning when you navigate to your local website over HTTPS in a browser.

To do this in Windows 10:

  1. Start -> Run certlm.msc to open the Certificate Manager tool
  2. Expand the Intermediate Certification Authorities folder in the left window of the tool
  3. Click the Certificates folder
  4. Find the certificate you just generated in the right-hand window
  5. Click and drag it over the Trusted Root Certification Authorities folder in the left window - this will set the certificate as trusted on your local machine.

3. Update IIS to use the new certificate

Now you can create/update the HTTPS binding for your local website in IIS to use the new certificate - you should see the new certificate listed in the SSL certificate: drop-down list.

That's it.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (1)

Collapse
 
fochoao profile image
Fernando Ochoa Olivares

Follow my guide dev.to/fochoao/make-iis-certificat...

For an OpenSSL one by request on IIS. Totally compatible.

Cloudinary image

Video API: manage, encode, and optimize for any device, channel or network condition. Deliver branded video experiences in minutes and get deep engagement insights.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay