WP8 emulator connecting to local WebAPi on laptop with wireless nic running


  • Hi,

    I have been struggling a bit with this. firstly Im running an HP envy laptop (lates generation i7) and had fun and games getting it to run hyper-v though that seems to be ok now. Im running VS2013, installed the SDK for WP8 and can debug a basic WP8 app which brings up the emulator ok running my test app.

    the issue I have is trying to get the app to get http client to connect to anything - I cant even get it to connect to google.com. I have been able to get internet explorer on the phone to connect to the internet, but I had to go into change adapter settings in windows and change the 2 virtual switches to use dhcp. This is very flakey though as ipconfig does generally shows a non class c subnet adapter when the emulator runs.

    Im using a laptop and dont have a wired cat 5 connection so the laptop is using my wireless connection in general. I disabled the wired nic and deleted the virtual machines and switches and VS2013 recreates the emulator and virtual switches fine  - but they revert to a network setting that doesnt match my wireless network settings, I have to go back into the adapter settings and reset them to DHCP.

    I have totally disabled the windows firewall on the laptop even stopped the service from running, I have read most of the top rated Stack overflow questions and still no joy. I am contemplating that this is actually 'not' (I have that word!) possible to do with a wireless nic, e.g. I need to use a wired cat 5 connection with dhcp to get the emulator to talk to the local laptop... I also tried a post that gets you to change the mac address range in the hyper-v manager - switches windows.

    Just to summarize, Im running 2 instances of VS2013, one is a webapi project the other is a windows phone 8 project, my http client code just hangs when it hits the getasync(....) call Im using my laptops ipaddress for the httpclient instance, and have bound the ip address to the local iis website that handles the webapi project. I have disabled the firewall, set the 2 virtual switches to dhcp, my local wireless network is running off a 192.168.0.X range, in network adatpters I have a wireless adapter , a bridge, a emulator internal virtual switch and wireless external switch(that shows connected to my wireless lan)... Even before getting the WP8 project to hit my local iis, I can get it to event get to google.com. I am running both VS2013 instances as Admin and local OS is Win8.1

    If I cannot resolve this is there a way of running the emulator from VMplayer or virtual box - last and grasping at straws idea!)


    • Edited by deanvanrooyen Tuesday, March 18, 2014 11:30 AM added extra info
    Tuesday, March 18, 2014 9:33 AM

All replies

  • 1 I haven't checked:


    Tuesday, March 18, 2014 1:12 PM
  • if you want to test web api with your windows phone emulator it will not work local host, 

    Please check following link for more information


     If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Tuesday, March 18, 2014 1:19 PM
  • Hi thanks for the reply

    I was going to post that link as well as this one to say that I have tried the solutions  - (I mentioned I have used the IP address) 'getasync(....) call Im using my laptops ipaddress for the httpclient instance, '

    this was the other post that runs through an example with  trying to connect to WCF


    that article your referenced that I  tried - if you read through it the ipconfig references 'ethernet' this means its not using the wireless nic...

    Tuesday, March 18, 2014 1:25 PM
  • deanvanrooyan,

    even i faced same problem with web api in localhost, the solution for this problem is host your web api in external web server and try to consume it then it will work

    thanks, prathap If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Tuesday, March 18, 2014 1:29 PM
  • Im thinking about that  - the only issue is that I cant event get httpclient to connect to google.com! I think it is an issue with the wireless nic /dhcp/ and the virtual machines...
    Tuesday, March 18, 2014 1:37 PM
  • I  might buy a wireless to ethernet hub and just use ethernet with the laptop... I have a sneaky suspicion this will work :(
    Tuesday, March 18, 2014 1:40 PM
  • I solved this with 2 steps,

    1st - changed to wired nic ethernet after removing the emulators and virtual switches, disabled the wireless nic, debugged the app VS asked to recreate the emulator - selected yes for internet access, and the emulator loaded fine and could access the internet through IE.

    2nd - code issue - I used a project from build 2013 for cross platform dev - this I suspect was written for wp7, I upgraded it to wp8, the issue was the the binding on the command object wasnt async, the command was using a class to do the http client call - in the class the method calling out was async, but it was deadlocking - what I needed to do was mark the command itself as async (as well) and it worked! the command was in my PCL project so I suspect there is a change in PCL that causes a deadlock when loading async calls from a non ascync 'parent' caller - possibly  the UI thread is blocked when loading in an external assembly and the entry point is not async when methods are called in certain scenarios...

    I can hit my local web api and the internet no issues now...

    Wednesday, March 19, 2014 9:39 AM