ASP.NET和Android无线调试没有互联网

问题描述:

我有一个是通过我的Andr​​oid设备,并显示在 Android应用程序 ASP.NET MVC Web应用程序一个的WebView 活动。

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

在这两个Android设备和服务器在同一网络连接上,我能够调试无线与的Visual Studio 2012 IIS前preSS

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.

您可以设置你的Windows 7笔记本电脑作为WIFI热点。

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

右键单击该链接的Cmd.exe,选择以管理员身份运行。

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

现在键入以下命令:

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

和preSS [Enter]键。使用密码更难一点猜测替换我的网与你想使用你的自定义网络名称,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.

不过在命令行中键入

netsh wlan start hostednetwork

和preSS [Enter]键火起来的虚拟适配器。

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

现在单击控制面板>网络和Internet>网络和共享中心>更改适配器设置,右键单击您的Internet连接,并选择属性。单击共享选项卡,勾选允许其他网络用户连接...,选择你的虚拟Wi-Fi适配器。

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.

从这里你应该可以看到你的Andr​​oid设备上的WiFi热点。连接之后,你应该能够执行通常的调试方法,在同一网络上时使用。

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.

另外,作为一个额外添加的,我敢肯定你知道这一点,但人谁正在寻找这一点 - 这也可以帮助你的Andr​​oid设备的无线调试。

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.

当(不是机器人)的本地调试它是好的简单地使用本地主机:端口地址。当使用Android然而(或其它设备,如一个UIWebView在iOS上),你不能访问这个地址,所以为了解决这个问题,你可以设置你的ip的地址,但有一个你必须采取几个步骤首先。

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.

确保您有最新的IIS设置,首先让你的IP(CMD.EXE> IPCONFIG)
在这个例子中我将使用192.168.1.42作为我的IP号码,58938的端口号。

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. 添加<绑定协议=HTTPbindingInformation =*:58938:192.168.1.42/>
    对ApplicationHost.config为绑定后的'localhost'。

  2. 运行的netsh的http添加urlacl URL = HTTP://192.168.1.42:58938 / USER =每个人

  3. 运行的netsh advfirewall防火墙添加规则名称=IISEx pressWebDIR = IN
        协议= TCP将localPort = 58938轮廓=私人REMOTEIP = localsubnet
        行动=允许

  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

来源:约翰Driessen的