Wednesday, September 28, 2011

How to enable SSL on IIS 7.0 for localhost

As a developer I have a need to do  this thing called development.  And for me to develop solutions that will one day live on a SSL enabled website, it just makes sense to enable SSL for localhost.

This walk through will hopefully get someone using IIS 7.0 up and running with SSL.  And IIS 7.0 makes this very easy to do.
  1. Make sure you have IIS 7.0 installed.
  2. Click on Start from your desktop.
  3. Hover over Administrative Tools.  This will present you with some additional options.
  4. Click on Internet Information Services (IIS) Manager.
  5. Under the IIS category, double-click on Server Certificates.
  6. Under the Actions pane on the right-hand side of the screen, click on Create Self-Signed Certificate.
  7. Enter a "friendly name" for the certificate request.  In this case I used 'Localhost' minus the single quotes.  Since I was aiming for https://localhost as my URL.
  8. In the Connections window to the left expand (if not already) in the follow order: Local Computer Name => Sites.
  9. Under Sites heading (in the left pane still) click on Default Web Site.
  10. On the right-side window pane select Bindings.
  11. In the Site Bindings window click Add.
  12. Set the following fields accordingly:
    1. Type => https
    2. IP Address => All Unassigned
    3. Port => 443
    4. Host name => 
    5. SSL certificate => Localhost (or whatever you named it)
  13. Click OK and Close to return to the management screen.
  14. You should now see Browse *:443 (https) in the far right window pane.  Click on it to verify that the binding worked.
    1. You may be warned that it is an "untrusted connection" or a "phishing attempt".  This is just your browser not liking a self-signed certificate.  You can ignore it.  Add https://localhost into your trusted sites to avoid it in the future.
That is it.  You have now enabled SSL on localhost for IIS 7.0!