1

I know the question sounds a bit confusing but here we go.

I am using an Azure VM to develop a cross platform app (Xamarin) and the app needs to utilise a .net core web API.

I am using a Google Emulator that has access to the internet.

What I have tried -

I have tried google emulators default connection 10.0.2.2:"MY WEB API PORT"/swagger. The result I get is "Bad request - invalid hostname"

I have tried a lot more but with no avail.

Any help is much appreciated.

IeuanW
  • 228
  • 1
  • 9
  • 25
  • Please try to use `127.0.0.1` or `10.0.0.4`(private IP address) to connect it. by the way, we can use `netstat -ant` to check this app running on which port. – Jason Ye Aug 28 '17 at 08:28
  • Thanks, ill give it ago when i'm back in work tomorrow. I've tried 127.0.0.1 and it never worked – IeuanW Aug 28 '17 at 08:36
  • OK, if possible, could you please show me how do you install it on Azure VM, in this way, we will find the root cause more efficiency:) – Jason Ye Aug 28 '17 at 08:39
  • @JasonYe-MSFT Hi, I just tried '10.0.0.4' with no luck, It says "Bad Request - Invalid hostname". The emulators are installed with visual studio. I use Android Virtual Device (AVD) Manager to launch the emulator. – IeuanW Aug 29 '17 at 08:03
  • The emulators installed on Azure VM? and the Android virtual device manager install on azure VM too? – Jason Ye Aug 29 '17 at 08:08
  • @JasonYe-MSFT Ye that's right – IeuanW Aug 29 '17 at 08:09
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/153095/discussion-between-jason-ye-msft-and-ieuanw). – Jason Ye Aug 29 '17 at 08:09

1 Answers1

1

Ok, the problem was that when I ran the Web service on ISS Express from Visual Studio it wasn't running on my local IP address 127.0.0.1:[MY WEB API PORT].

I found this out thanks to @JasonYe-MSFT who told me about the command

netstat -ant

When I ran the command I found that the port that my web app was running on wasn't attached to my local IP instead it was formatted like so

[::]:64339

So in visual studio instead of running the web app using IIS Express, i changed it too the project itself and when i ran the command again, the port now had my local IP address connected to it.

Inside the android emulator, i can now load the web api using AVD default IP address '10.0.2.2'. So the full address is

10.0.2.2:"MY WEB API PORT"/swagger

IeuanW
  • 228
  • 1
  • 9
  • 25