Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable Android device to access IIS Express whilst on same network

I am looking for a way to easily test the mobile version of my site in development.

I have set up IIS Express, such that I can access locally using:

http://localhost:1025/AppName/

or by using my PC name (dazbradbury-pc)

http://dazbradbury-pc/AppName/

This then works from any machine on my network.

However, when I try to use this address from an android device, it simply doesn't work. Has anyone got this working? If so, what further steps were required?

like image 222
dazbradbury Avatar asked Jan 23 '12 18:01

dazbradbury


People also ask

Can IIS Express be accessed remotely?

IIS Express Run From a Remote Machineconfig by going to IISExpress\config in your documents folder. Right click the devenv.exe icon and choose properties. Then select the compatibility tab. You can also choose to change this setting for all users if you wish.

How can I access my localhost from my Android device?

On your mobile device's browser (any will work), navigate to http://<Local IP Address>:<port number> . For example, if I was serving on localhost:8080 and my local IP address is 123.45. 67.890, on my mobile device's browser I would navigate to http://123.45.67.890:8080 .

How to access IIS Express?

Opening IIS Express in WindowsRun the command box as an administrator as it needs access to configuration files. Change to the website directory (here using cd \website ). In the command box type runphp . The command file will configure IIS Express to use the website directory as a website.

How can I access localhost from my phone?

You can access your host machine with the IP address "10.0. 2.2". This has been designed in this way by the Android team. So your webserver can perfectly run at localhost and from your Android app you can access it via "http://10.0.2.2:8080".


1 Answers

Thanks to @SLaks for the information:

That's probably because Android doesn't do WINS name resolution. Try the IP address.

Hence, I updated my IIS Express to point to an IP address by inserting into the bindings in applicationhost.config an IP address:

<binding protocol="http" bindingInformation="*:80:192.168.1.97" />

where 192.168.1.97 is the local IP address of my machine.

I can now access my machines IIS Express instance from my android device.

like image 198
dazbradbury Avatar answered Oct 15 '22 11:10

dazbradbury