Android simulator access to local localhost failures and solutions

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.