Blog

Android Emulator Virtual Hosts with IIS

September 10, 2010

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

3 Comments

Arun Prabhu
Arun PrabhuMarch 25, 2014 at 3:12:50 am

Thank you,

Pedro
PedroNovember 24, 2015 at 9:51:37 am

Could you put the line of the binding because I'm trying something is worng because it doesn't work. Thanks!

Jason Holden
Jason HoldenNovember 24, 2015 at 11:01:06 am

@Pedro, there's not really a line number per se. It's the IIS bindings dialog box. IIS Manager > Select the Site > Right-hand Actions column under 'Edit Site' > Bindings

Leave the IP Address set to All Unassigned, leave host name blank, enter any available port (i.e. 9191)

The Android emulator may have undergone several revisions since this entry so the default IP address may be different.

You're welcome to private message me and I will try to help.

Leave Your Comment

Your email address will not be published. Required fields are marked *


about me

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