I'm developing a Xamarin Forms App that communicates with a Web API. I am currently able to debug and test this communication using Visual Studio for Xamarin Forms and an Android Emulator communicating with my test Web API that I have deployed to the internet.
What I would like to be able to do is to debug and test the Phone App communicating with the Web API on my localhost so I can quickly make changes to the Web API if necessary without deploying to the web - I also believe I can debug the Web API using the localhost version.
To normally access the Web API on localhost, I can use the URI h**p://localhost:port/API where port is a port number assigned by Visual Studio when I start up the Web API within Visual Studio.
However (I believe) I have to use a different URI when using an Android Emulator - hp://10.0.2.2 which 'maps' to the localhost of my development machine. And this works if I use the browser of the emulator to browse to this URI, I indeed see whatever content is at the equivalent of hp://localhost if I were to use a browser on the dev machine itself.
What I can't seem to be able to do is access the Web API at the port on localhost. If I use the URI h**p://10.0.2.2:port/API inside my App in the emulator I get a 'Bad Request' message. Same message if I browse to the URI using a browser on the emulator.
I have done a bit of hunting, but couldn't find an answer to this. Has anyone else found a solution to this?
I'm guessing the solution may be a tweak to IIS on the dev machine. So, just in case, I am using IIS 10.0 on the machine (but does Visual Studio actually use IIS Express? Sorry IIS is not my strong point)