I have am setting up a very simple test site on my localhost under IIS which needs to be accessible locally from https.  IU have followed the steps below:

In IIS for my local server, I have created a self signed certificate and stored in the "Personal" store
I have added a https binding for my test site to this new certificate, the hostname is testite and the port 7001
Added the entry '127.0.0.1   testsite' to hosts file.

When I try to access https://testsite/index.html through the browser, the browser returns the following error:
NET::ERR_CERT_COMMON_NAME_INVALID
Same problem soccurs if I add the port number to the url, i.e: https://testsite:7001/index.html
More informatiom on the error shows the following:
This server could not prove that it is testsite; its security certificate is from Muzz2. This may be caused by a misconfiguration or an attacker intercepting your connection.


Self signed certificate not working on localhost IIS
The solution involved using Powershell rather than IIS manager to generate the self signed certificate.  ISS always used the machine name rather than the sitename as the common name.
The powershell command I used was as follows:
New-SelfSignedCertificate -DnsName testsite -CertStoreLocation cert:\LocalMachine\My
After which mmc was used to place the certificate in the Trusted Root Certification Authorities, and the certificated bindings updated in IIS as you you usually would.
