ASP.NET and Android Wireless debug without internet

China☆狼群 提交于 2019-12-03 13:32:53

You can setup your Windows 7 laptop as a WIFI hotspot.

right-click the Cmd.exe link and select "Run as Administrator".

Now type the following command:

netsh wlan set hostednetwork mode=allow ssid=MyNet key=MyPassword

and press [Enter]. Replace "MyNet" with the name you'd like to use for your custom network, and "MyPassword" with a password that's a little harder to guess.

Still at the command line, type

netsh wlan start hostednetwork

and press [Enter] to fire up the virtual adapter.

Now click Control Panel > Network and Internet > Network and Sharing Centre > Change Adapter Settings, right-click your internet connection and select Properties. Click the Sharing tab, check "Allow other network users to connect...", choose your virtual Wi-Fi adaptor.

From here you should be able to see the wifi hotspot on your android device. Once connected you should be able to perform the usual debug methods as used when on the same network.


Also as an added extra, I'm sure you know this, but for people who are searching for this - this may also help in wireless debugging of your android device.

When debugging locally (not on the android) it is fine to simply use your localhost:port address. When using your android however (or other devices such as UIWebView on iOS) you can't access this address, so in order to work around this, you can set up your ip as the address but there are a few steps you have to take firstly.

Ensuring you have the latest IIS setup, firstly get your ip (cmd.exe > ipconfig) In this example I will use 192.168.1.42 as my ip number, and 58938 as the port number.

  1. Add <binding protocol="http" bindingInformation="*:58938:192.168.1.42" /> to applicationhost.config after the binding for 'localhost'.
  2. Run netsh http add urlacl url=http://192.168.1.42:58938/ user=everyone
  3. Run netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=private remoteip=localsubnet action=allow

Source: Johan Driessen

If the ASP.NET Application doesn't need to connect to the Internet, it's possible. You just need to put the Web Application and the Android phone in the same Wireless LAN. I used to debug my Android Application with a Web Application powered by Django. This method works.

Do you want to debug the app or just show how it works in an Android phone?

If you just need to show how it works in your phone, open the 80 port in your computer and it should work fine in your Android device.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!