In the development of mobile website is, using the Android simulator test, enter localhost in the phone browser to access the local server failed!
Reason:
In the Android system, localhost is 127.0.0.1.
LocalHost is also a 127.0.0.1 in Windows systems
The Android Emulator (simulator) takes itself as localhost, meaning that the code uses localhost or 127.0.0.1来 access, is to access the simulator itself!
Solution 1:
If you want to access the local computer in the simulator simulator, then use the Android built-in IP:10.0.2.2
To access an instance:
Solution 2:
is to use the IP address of the native LAN, for example, my LAN ip:192.168.1.114
However, the corresponding IIS, domain name bindings are configured as follows:
Note: For IIS Express access is not valid, the Android emulator browser cannot directly access the Iisexpress project failure.
Android simulator access to local localhost failures and solutions