Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 CTP5 Android Emulator loopback to localhost?

I am using VS 2013 to connect with the new VS2015 Android Emulator. This seems to work now and I can debug, set breakpoints etc which is all fine. (Now, I would use VS2015 but it won't deploy properly -never mind). I am also developing the server app on my machine and using Fiddler as an http debug aid.. not an uncommon situation I am sure.

The server is running (also under debug in another instance of VS 2013) using IIS Express and I have added bindings to the applicationhost.config so the IISExpress server is visible on my LAN from other PC's and I've checked it is visible.

Try as I might I can not seem to get the Emulator to send the http requests back to my computer. My javascript uses a servicebase to hold the url:

var serviceBase = 'http://192.168.2.4:64963/'; //'http://169.254.220.177:64963/';  //'http://10.0.2.2:64963/'; //'http://localhost:64963/';

The commented ones show the ones I have tried. None of these works.. the first is the IP of my machine on the LAN, the rest are various ones I have picked up here or the Android dev site.. I have also tried:

http://mymachinename:64963

Because I am bringing both web AND API services from this URL I have also tried a chrome browser on my real android phone (over wifi on my LAN) and this can't get to my dev machine either (where my other pc's can). So I get that it probably can't resolve the names? But really not sure where to go next? I wondered about the Hosts file on my PC but not sure if I can/should set an IP address as a host name? .. any pointers? Thanks, Brett

like image 471
Brett JB Avatar asked Dec 11 '22 01:12

Brett JB


1 Answers

169.254.80.80 is the localhost loopback.

By going to Additional Tools in the VS emulator for Android (click the >> button on the right hand side) and selecting the Network tab, you will get all the information about the network connectivity.

For the localhost loopback, use the address listed under the Desktop Adapter #2. Desktop Adapter #1 should work as well, which is the IP address of your machine.

like image 106
Daniel Avatar answered Dec 29 '22 00:12

Daniel