简体   繁体   中英

testing local IIS website on virtual machine on an android phone

I know there tons of topics about this, but after trying a lot, I feel tired. So here is my problem: I have an asp.net application (IIS server, debug mode) that I run on a virtual machine (vmplayer). The Ip is set automatically but I got it through ipconfig, and I first tried to connect with my 'main' windows (hosting the virtual machine), it did'nt work, so I installed sharpProxy , converted my IIS port to another one, add an inbound rule to the firewall, and it worked! But when I tried with an android phone (2 actually), it didn't: "connection timed out".

Interesting note: when I ping the server from my android mobile, I have no answer from it.

No matter what I try, it doesn't work. Any idea ? Dns, hosts files from android ?

Thanks for your answers!

Update: You have found your answer (great), i'll update this slightly and maybe someone will find it useful...

A few things to check that are typical for what you are trying to do:

  • The VM webserver is public (not listening on localhost, no firewall rule blocking it)

On the hypervisor either:

  • Allocate the VM a public interface ("bridged" or in vagrant "public_network")
  • Access the VM directly

Or

  • Or (with "NAT") use port mapping from the Host (eg 4017) to the Guest VM (5000) (vmware uses: <external port number> = <VM's IP address>:<VM's port number> under [incomingtcp] ie 4017 = 172.16.126.128:5000 )
  • Make Host port public, eg you local firewall allows 4017 inbound
  • Access the VM via the Host IP and port (4017)

Or

  • Use a proxy from the host to the guest

Okay,

In the end, I found the trick: as my mobile phone didn't detect my VM windows on the network, I felt the problem could be that the VM was not configured for the wireless router...

The problem was VMplayer doesn't enable Wifi connection by default...

Modified my network VM settings (Network adapter -> Bridged: Connected directly to the physical network) which actually connects your VM to the network, otherwise, it seems to be only connected to the host. Then ran sharpProxy, and it worked !!!!.

So, it should be:

  • Check your network VM settings before anything else.
  • Get your VM IP address through the command window (cmd -> type "ipconfig" and enter, look at "local network ethernet card" IPv4 , should be something like 192.168.xxx.xxx, was 192.168.1.5 for me)
  • Get your local port (you should see it in your browser when you launch your solution ( http://localhost:4017 ). Here it was port n°4017.
  • Launch sharpProxy (link in the original post), choose your Ip address (there should be only one proposition), enter your internal (local) port, and choose a random external port (I chose 5000).
  • Now you know that your address to connect to your local IIS server is http://xxx.xxx.xxx.xxx:xxxx (in my case: http://192.168.1.5:5000 ).
  • Test it with your phone, it should work. If it doesn't, try on your windows hosting the VM. If it works, most probably there is a problem with your VM wifi settings. If it doesn't work, check your firewall inbound rules (tons of topics about it).

Thanks KCD for the tip of Fing software which led me to the solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM