Apply for Certificate#
There are many tools available online to apply for free certificates. I stumbled upon a website that allows online operations: https://httpsok.com/
After logging in with WeChat scan, click on the certificate management menu on the left, then click the free apply for certificate button on the right, and follow the prompts on the page to complete the operation. After finishing, wait for 1 minute to complete the application:
Download Certificate#
Once the certificate status changes to "Issued," you can click the download button. Here, I choose to download the IIS type:
After downloading, you will receive a compressed package. Unzip it to get two files:
_.yourdomain.pfx
pfx-password.txt
Configure IIS#
Note the prerequisites:
Then click the help button next to the recently downloaded certificate button, which will redirect to: https://help.aliyun.com/zh/ssl-certificate/user-guide/install-ssl-certificates-on-iis-servers
Just look at step two.
Configure HTTP Redirection to HTTPS#
There are two methods.
The first and simplest method is to use the middleware provided by Microsoft: https://learn.microsoft.com/en-us/aspnet/core/security/enforcing-ssl
The second method is to use Url Rewrite in IIS: https://sdwh.dev/posts/2021/09/IIS-Http-Redirect-To-Https/