Android Emulator Virtual Hosts with IIS

I do most of my development locally (using my local IIS webserver). My local webserver makes use of host headers to host multiple development sites on a single IP. After reading several articles and blog entries I was unable to find a good solution to allow using host headers with Android. The emulator can access the host machine out of the box on 10.0.2.2, but that will only show you the default IIS site.

Tom Deryckere’s article (http://www.mobiledrupal.com/content/using-virtual-hosts-android-emulator) explains how to get host headers working on the emulator, but I didn’t want to run terminal commands every time I launched the emulator or keep updating my host file across mulitple emulator images (I’m really lazy.)

The solution was pretty simple and I’m embarrassed that I didn’t think of it before. I simply added another binding entry to a new port:

In IIS Manager:

  1. Select the site you want to access
  2. Click ‘Bindings’ in the right side Actions pane
  3. Click ‘Add…’ on the Site Binding dialog that is displayed
  4. Give the site a any valid port number that is not currently in use (example 9191)

Now in the Android emulator you can access your site using http://10.0.2.2:9191

about me

An information technology professional with twenty five years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.