0

I'm currently developing a UWP phone app which calls a Web API.

When using the Visual Studio 2015 (Update 3) mobile emulators, calls to the Web API work fine for emulator versions 10.0.10240.0 and 10.0.10586.0. However, for the latest emulator versions 10.0.14393.0 my API calls all fail.

The http address I'm using to access the Web API, which is running under IIS Express, is http://localhost:64210. Using the emulator's browser, I can access this URL in 10240/10586, but not 14393.

I've tried following the relevant suggestions in this article by Anthony Baker, and this MSDN article, (both of which relate to the Windows Phone 8 emulator) but neither has led to a resolution.

I also noted that in the Hyper-V Manager the network setting for the 14393 emulator have the additional Network Adapter "Microsoft Emulator NAT Switch", but my experiments with this indicate it is not causing the problem.

Can anyone suggest a possible solution to this problem?

grahama
  • 100
  • 1
  • 9
  • I cannot reproduce this issue. Have you tested on other devices? – Xie Steven Dec 08 '16 at 06:53
  • Yes, I have the problem on a desktop machine, a Surface Pro 3, and a Surface Book (which is a new machine with a fresh installation of VS 2015). – grahama Dec 08 '16 at 09:05
  • It's very strange. Maybe, KenTucker's article [Fixing your Hyper-V emulators](http://www.onteorasoftware.com/2016/12/fixing-your-hyper-v-emulators.html) would be helpful to you. You could try it. – Xie Steven Dec 12 '16 at 07:40
  • FYI MSFT - I am having the same challenge. The API works in older emulators but not the 14393. – George M Ceaser Jr Feb 19 '17 at 23:47

1 Answers1

0

You can try changing "localhost" to "10.0.2.2".

Base on this, if you are calling a local host from an emulator, you need to call 10.0.2.2 rather than the original 127.0.0.1. This is because localhost refers to the localhost of the emulator.

zanacar
  • 1
  • 3