IIS Express Access from Android Emulator

I know that such questions have been asked many times, but I still cannot get it to work correctly. I would like to have access to IIS Express on my host machine from my Visual Studio Android emulator. I have the following bindings in my .vs \ config \ applicationHost.config file for my site:

<binding protocol="http" bindingInformation="*:7265:MyComp" />
<binding protocol="https" bindingInformation="*:44300:MyComp" />
<binding protocol="http" bindingInformation="*:7265:10.0.2.2" />
<binding protocol="https" bindingInformation="*:44300:10.0.2.2" />
<binding protocol="http" bindingInformation="*:7265:localhost" />
<binding protocol="https" bindingInformation="*:44300:localhost" />

When I launch the website on my host, in the list of running applications I see the bindings for MyComp and localhost, but not those related to 10.0.2.2. On my host, I can connect using MyComp or localhost without any problems.

In the emulator, I can use http://10.0.2.2 to connect to IIS 7.5 (not express) on my computer without problems. In my emulator, I cannot connect to http://10.0.2.2:7265 or https://10.0.2.2:44300 , which is a site running in IIS Express. I get an HTTP 400 error: "Request host name is invalid." I am sure that this is due to the fact that I do not have IIS bindings configured correctly, but I'm not trying to work. Any ideas?

Thank!

+4
source share
1 answer

You missed some basic facts. 10.0.2.2 on the Android emulator transferred to 127.0.0.1 on the host. So change the bindings to

<binding protocol="http" bindingInformation="*:7265:127.0.0.1" />
<binding protocol="https" bindingInformation="*:44300:127.0.0.1" />

, ,

https://blog.lextudio.com/how-to-let-android-emulator-access-iis-express-f6530a02b1d3

+2

Source: https://habr.com/ru/post/1675661/


All Articles