Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET and Android Wireless debug without internet

I have an ASP.NET MVC Web Application which is displayed through my Android device on the Android Application with a WebView activity.

When both the android device and server are on the same internet connection, I am able to debug with wireless with Visual Studio 2012 and IIS Express.

Soon I need to demonstrate the application at a conference at which I won't have internet to connect to. Is it possible to do a wireless debug without internet?

I have been searching for a solution but can't seem to find one that works. I have explored trying to tether the device or setting up my laptop as a virtual device but neither have seemed to work for me.

like image 847
Yorimitsu Avatar asked May 24 '13 02:05

Yorimitsu


2 Answers

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

like image 179
benallansmith Avatar answered Nov 09 '22 18:11

benallansmith


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.

like image 33
Shunix Avatar answered Nov 09 '22 18:11

Shunix