Android: "Bad Request-Invalid Hostname" When accessing localhost from emulators

android, android-emulator, localhost

Solution

I have answered this on another stackoverflow question, using third party software `ngrock`

Check this Android emulator not connecting to localhost api

Problem

I am not able to use localhost with xamarin.android application. I have executed Web project & Service project(not mobile app) on Chrome Browser. The displayed port number I tried browsing in Android Studio emulators & Genymotion emulators by appending 10.0.2.2: & 10.0.3.2: respectively, I got result Bad Request-Invalid Hostname. Even I have tried Service project port number, both not working. Web Project: ASP.NET project using Visual Studio 2017 & Having service project in the same solution.

Original source

Related problems