2

I'm have a WebApi project which gets deployed locally on my machine as http://localhost:6143 or http://127.0.0.1:6143.

However when I try to browse to that endpoint on the visual studio emulator for android browser, I get net:err connection timed out.

Note that on the emulator I'm using http://10.0.2.2:6143 since localhost won't work on the emulator (since it's a vm, localhost refers to itself).

I've also tried 127.0.0.1:6143 and get connection refused.

I also added port 6143 to the incoming firewall rules.

Weird thing is that the other emulators installed by xamarin work very well with no configuration issues.

Any clues why this doesn't work? All my searches and approaches have failed so far.

KwackMaster
  • 180
  • 2
  • 13
  • I found this article helpful to solve my localhost access problems: http://www.damirscorner.com/blog/posts/20140113-ConnectingToLocalIisExpressServerFromWp8Emulator.html – ahaaman Oct 21 '15 at 07:56

2 Answers2

4

Figured this out after some hunting.

In VS 2015, the applicationhost.config file for asp .net projects is no longer located in the Documents\IISExpress folder. It's now in your project root at .vs\Config.

Once I figured that out, the solution was easy. I went into the config and added a binding as follows (for some reason this was hidden from my original post)

  1. Locate the sites element in the config file for your website/webrole. It's something like:

    `<site name="MySite.Service.WebRole" id="3">`
    
  2. Add a new binding element

    <binding protocol="http" bindingInformation="*:6153:myMachineName" />

That's it. Now within the emulator, I can just access http://myMachineName:6153 to access the service.

KwackMaster
  • 180
  • 2
  • 13
  • "added a binding as follows". How exactly? – CularBytes Aug 21 '15 at 18:41
  • Just edited my post to update it, sorry it was included previously but not annotated correctly. – KwackMaster Oct 23 '15 at 16:26
  • I did this now I get an Access is denied when I run my project. I had to run VS as Administrator to get the project to run again but it did work. My device can now get to my service. – Brett Mathe Apr 08 '16 at 21:56
  • There are clearly other options, https://blog.lextudio.com/how-to-let-android-emulator-access-iis-express-f6530a02b1d3 – Lex Li Jul 15 '17 at 04:12
0

Conveyor

For this you only need the IP-adress of the Webservice deployed by IIS-Express. To get the IP use the Visual Studio Extension "Conveyor".

PhiWue
  • 1