Skip to content Skip to sidebar Skip to footer

Invalid Hostname - Not Able To Connect Iis Express From Android Emulator

I am trying to connect a WCF service hosted at my local IIS express from an Android app. Currently, I am testing this on an Emulator. Local URL for the service is http://locahost:

Solution 1:

I tried something else which worked , I added the IP address of my system within the IIS Express applicationhost.config file bindings sections.

<bindings><bindingprotocol="http"bindingInformation="*:40000:localhost" /><bindingprotocol="http"bindingInformation="*:40000:192.168.5.118" /></bindings>

I am able to call the service now

Solution 2:

As I understand it, 10.0.2.2 is an alias for 127.0.0.1, so add that to your applicationhost.config binding for your site, e.g.

<sitename="MySite"id="1"><applicationpath="/"applicationPool="Clr4IntegratedAppPool"><virtualDirectorypath="/"physicalPath="{yourpath}" /></application><bindings><bindingprotocol="http"bindingInformation="*:26013:localhost" /><bindingprotocol="http"bindingInformation="*:26013:127.0.0.1" /></bindings></site>

Bear in mind that these days if you're using Visual Studio the relevant applicationhost.config for your site may not be in c:\users\... but rather in a .vs\config folder at the root of your solution.

Solution 3:

Add Internet Permission, Network State, and WifiPermission in AndroidManifest.xml

Solution 4:

  1. What's with "port 40000"??????? I'd definitely try a lower port number (like something below 32768 ;))
  2. Make sure your androidmanifest.xml has internet permissions
  3. Make sure "api/authenticate" is defined and available in IIS
  4. Make sure Windows firewall isn't blocking port 40000
  5. Useful tools include:
    • ping (so you can "ping 10.0.0.2"; available in OOTB Windows)
    • telnet (so you can "telnet localhost NNN"; you must add this in Windows Features)
    • Firefox and Firebug
    • Wireshark

Post a Comment for "Invalid Hostname - Not Able To Connect Iis Express From Android Emulator"