Share via


Why can’t the Windows Phone Emulator go online?

I recently had an opportunity to work on a scenario where the Windows Phone 8 Emulator is not able to connect to the internet. Usually, one wouldn’t notice until you deploy a Phone App on the Emulator through Visual Studio and it won’t connect to web services, internet, etc. To confirm if it is the Emulator that is not able to connect to the internet or it’s just your App/web service, you can simply start Internet Explorer on the Emulator and browse to a web site.

You would see something like this:

 

 

OK, now that we have confirmed that the Emulator is not able to connect to the internet, how do we go about figuring out the cause and fix it?

To start with, let’s check the network in the Hyper-V Manager for the Emulator image – as the former is required on development machine to host the WP Emulator. You can check the Hyper-V’s “Virtual Switch Manager” for the Virtual Switches and their configuration:

 

 

 

You should normally be able to see switches related to Internal and External networks as:

  

                                                   

 

Usually, the External Network is the one on which the host machine uses to connect to the internet. So, if the host machine can go online, this configuration is probably all OK. Having eliminated the generic external factors that can cause network connectivity issues, let us move closer to diagnose network problems directly related to the Emulator.

It all started when one of colleagues from the Networking team, asked me what the IP address on the Emulator is - so that he can perform some diagnostic steps. This is a time where we get to know the Emulator in a little more detail – see the screen-shot below:

 

 

As you see, clicking the >> ” on the bar parallel to the Emulator will open a small window with 4 tabs. The last tab is for “Network”. To explain in simpler terms, there are two adapters here – one is for internal use by Emulator and other is for external network connectivity. Each adapter will have an IP address (IPv4) associated with itself. The one of our interest is under Adapter #2.

I have erased out the IPv4 address that is assigned to Adapter #2 (Yellow box), but you find that the IP assigned here starts with 169.254.x.x…., then Bingo! -  we have figured out the problem. How?

The IP addresses starting with 169.254.x.x ….  Are usually the self-assigned default addresses to a device and not really helpful to get the device to go online.  This IP should either be a static IP or the one assigned by the DHCP server (if you have one in the environment) for the device to be able to connect to external networks.

Hence, the requirement given at this article comes in handy and helps us understand Windows phone Emulator’s ability to go online and its relationship with DHCP:

 

To connect to network destinations from the emulator, your network must meet the following requirements:

• DHCP. The emulator requires DHCP because it configures itself as a separate device on the network with its own IP address.

• Automatically configured DNS and gateway settings. It’s not possible to configure DNS and gateway settings manually for the emulator.

 

 

To sum it up, if your environment does not provide a dynamic IP to the Emulator and you see a 169.254.x.x …  address on Adapter #2, then you can check with the networking experts about presence of  a DHCP server in the environment and how can your host machine get a dynamic IP assigned through it. More on DHCP servers at https://technet.microsoft.com/en-us/windowsserver/dd448608.aspx

Above illustration is just one of the scenarios where Emulator cannot connect to the internet and its diagnostics. There is more information to troubleshoot other issues with the Emulator at https://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681694(v=vs.105).aspx

 

Happy WP8 coding! Follow us on twitter, @wsdevsol. Comments are welcome,both below and on twitter:#WSDevSol.

 

-Sagar

Comments

  • Anonymous
    October 04, 2013
    That is good to know, the ip issue with the emulator. If my memory is good, the 169 ip addresses is an early MS adoption of the DHCP spec athe the time

  • Anonymous
    March 06, 2014
    Thanks,  this was really clean - I am into same problem with my LAN ....

  • Anonymous
    October 17, 2014
    The comment has been removed

  • Anonymous
    November 24, 2014
    Hi Sagar, checked all settings as per your blog. Still internet connection on emulator is not working.