Sunday, April 24, 2016

Enable your Visual Studio Emulator to make https calls to your IIS Web project

Step 1: Set up IIS

Follow the steps as outlined here.
Summary:
  1. Create a self-signed certificate on the web server
  2. On the Default Web site, create an ssl binding, using the certificate created in 1.
  3. Configure SSL on the default web site to require SSL certificates, but ignore client certificates

Step 2: Add inbound rule for https port on the firewall

Basically - as far as I can make out - because the emulator is running on virtual machine, you need to open up your the port that it's communicating on to your machine for https calls.
Check out this article for more details on IIS Express and opening up a port.

Summary:
  1. Open windows firewall | Advanced settings
  2. Click "Inbound Rules" , and then "New Rule" 
  3. Select "Port" as rule type
  4. Add the https port number used in IIS to communicate (default is 443)
  5. Leave default of "allow connection"
  6. Check Private and Public 
  7. Choose a name you will remember in case you need to disable it

A quick way to test if it's working is to browse your https web url from the emulator browser. If all is well, you should see something along the lines of: