Surfing your local IIS from the Device Emulator

This is a question that comes up from time-to-time as well as connecting to the Internet via the device emulator.  I usually send a quick email with steps but that's dumb.  Instead, I decided I'd write a blog post on it that I can refer customers to.

Connecting to the Internet

Launch Visual Studio (2005 or 2008) and go to the Tools | Device Emulator Manager to view a list of installed emulators:

image

Choose an emulator from the list and click Actions | Connect to launch the emulator.  Once the emulator is running, select File | Configure to setup networking.

image image

Check the "Enable NE2000 PCMCIA network adapter" checkbox, choose an option, and then click OK.  Note that there are many other options to configure for a device emulator such as mapping serial ports, setting battery level, enabling speakerphone, headset, or carkit options, etc. 

Once you enable networking, the device emulator should display the icons showing that it is connected.

image

Note that to enable phone networking to simulate making and receiving calls, you would use the phone emulator tool to connect to the device emulator.

At this point, try to surf the web with Pocket Internet Explorer.  A good link to try is https://mobile.live.com.  You may get this message:

image

Click the settings link to configure connections.  If you are on a corporate network or a network with a proxy server, you probably need to configure a proxy server by clicking the "Set up my proxy server" link.  If that does not help, or you are not on a network with a proxy server, go to Settings on the device emulator and open the Connections application. 

image

Click on the Advanced tab and click the Select Networks button.  Set both options to "My Work Network". 

image 

Those are the steps it took me to connect to the Internet from the device emulator.  Next up is connecting to your local IIS on the host machine. 

Connecting to Your Local IIS

Once you are connected to the Internet, the next step is to setup access to your local IIS server.  Make sure IIS and running first and then try accessing your local IIS server in the desktop browser.  https://localhost is how we normally reference web services, etc. when writing applications but localhost doesn't work from the device emulator.  You have to access your desktop IIS server from the desktop's IP address.

Troubleshooting

Before diving into application development, be sure to check both Internet access and local IIS connectivity using Pocket Internet Explorer first.  if you are not able to access either the Internet or the local IIS on the host machine via IP address with Pocket IE, go through the steps above before proceeding.

if you are having issues connecting to your local IIS machine, you may need to open up ports on the Windows Firewall or any other third-party Firewall applications running sa well.