Sunday, February 23, 2014

Problem Running application in IISExpress in Visual Studio over SSL

I Currently set up an Azure VM to use as a development machine, I used MSDN's Default Visual Studio 2013 Image.

When I try to run my web application locally Internet Explorer gives me a "This page can't be displayed" error... firefox gives me "The connection was reset".
When browsing to the default non https port everything works as expected though...


so the solution:

1. uninstall iisexpress 8.0 (Control Panel > Uninstall a program)
2. mmc.exe, Add/Remove snapp-in, Certificates, select  Local Computer (Click Next), Finish
   here look under Personal, Certificates and delete the certificate Friendly Name = "IIS Express Development Certificate"
3. Reinstall IIS Express 8.0
4. following actions outlined in step 2. find the new "IIS Express Development Certificate", double click and goto details, find the thumbprint and copy the hash: ‎38 b3 05 a5 d2 1c ba 8b cb 45 fa 03 06 9a d4 b6 94 00 97 f9
5. remove the spaces from the hash: ‎38b305a5d21cba8bcb45fa03069ad4b6940097f9
open an elevated command prompt.
netsh http show sslcert > sslcert.txt

look for the entry matching your port. In my case it was this:
    IP:port                      : 0.0.0.0:44303
    Certificate Hash             : f5584bb1e88d4240d962bec7120e5a90302ff3b9
    Application ID               : {214124cd-d05b-4309-9af9-9caa44b2b74a}
    Certificate Store Name       : MY
    Verify Client Certificate Revocation : Enabled
    Verify Revocation Using Cached Client Certificate Only : Disabled
    Usage Check                  : Enabled
    Revocation Freshness Time    : 0
    URL Retrieval Timeout        : 0
    Ctl Identifier               : (null)
    Ctl Store Name               : (null)
    DS Mapper Usage              : Disabled
    Negotiate Client Certificate : Disabled


run:
netsh http delete sslcert ipport=0.0.0.0:44303
netsh http add sslcert ipport=0.0.0.0:44303 appid={214124cd-d05b-4309-9af9-9caa44b2b74a} certhash=38b305a5d21cba8bcb45fa03069ad4b6940097f9

references:
Hanselman's blog