.NET developers need a way to host their sites making them available to end users.
Options like Azure app service are an option to minimize the following steps.
Sometimes you want flexibility or may have an existing server.
Steps to test on localhost
- Enable IIS on Windows server or Windows 10/11
- Create a web app in IIS – Create a new folder and point to it in IIS
- Install the .NET 7 hosting bundle https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/hosting-bundle?view=aspnetcore-7.0
- Create and publish a .NET web application
- Copy the published files to the folder
- Start the site
Steps to add a domain
- Select the site and click bindings on the right hand side
- Add binding
- Select Type https and the domain on the server. For the hostname add the site domain
- Login to your domains DNS and add an A record pointing to the server IP address selected above
- Select a development SSL certificate (details on adding a free SSL certificate below).
Steps to add an SSL certificate
There a few ways to enable SSL for your site on IIS
You can buy one from your hosting provider. This may require converting it to a format compatible with IIS. A good tool for this is the Digicert SSL tool. You can add the SSL by clicking on the main server root in IIS and adding via SSL certificates. This guide does not show this in detail. Searching install SSL in IIS would provide more detail.
The way explained here is to use LetsEncrypt to generate a free SSL certificate. Use the win-acme program to generate an SSL certificate.
“This is a ACMEv2 client for Windows that aims to be very simple to start with, but powerful enough to grow into almost every scenario.”
Download: https://www.win-acme.com/
Run and follow the instructions to automatically install an SSL cert in IIS.
If you require any help setting up SSL certificates for your web applications get in touch with Black cat computers at [email protected] or call 01480 757691