I have a Windows Phone 8 App. It uses a series of WebAPI 2 calls to retrieve data from the server. In Visual Studio 2013 I can run the WebAPI project in Visual Studio and then run the App on an emulator through Visual Studio and everything works. For this to work I do have to run Visual Studio 2013 as an Administrator and I had to add an extra line into the IISExpress applicationhost.config file under the API application's entry as seen below:
<binding protocol="http" bindingInformation="*:56952:192.168.1.59" />
This is the line of code in the App that sets the location of the WebAPIs:
public const string APIPrefix = "http://192.168.1.59:56952";
It does not matter if I run the app on a Windows Phone 8.1 Or Windows 10 Mobile emulator, as long as I am running through Visual Studio 2013 it connects to the WebAPI project I have running in Visual Studio. Note that 192.168.1.59 is the IP address of my development machine where I am running Visual Studio.
When I upgrade the projects to Visual Studio 2015 and run everything the exact same way (run as administrator and the project names are exactly the same so I don't need to make a change to the applicationhost.config file) any call to a WebAPI returns the "Not Found" message.
Any idea what I am missing in Visual Studio 2015 to make this work?
So I did find a fix for this. If I change the API Prefix from:
APIPrefix = "http://192.168.1.59:56952";
to
APIPrefix = "http://localhost:56952";
it seems work everywhere except on the Windows 10 Mobile emulator version 10.0.14393.0. I have found the problem with that version of the emulator reported on another thread here
Unable to access local Web API from Visual Studio 2015 WIndows 10 Phone Emulator
Hope this helps other people.