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:
Now in the Android emulator you can access your site using http://10.0.2.2:9191
Thank you,
Could you put the line of the binding because I'm trying something is worng because it doesn't work. Thanks!
@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.
An information technology professional with twenty five years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.
3 Comments