调试在Android手机上的ASP.NET MVC应用程序 [英] Debugging an ASP.NET MVC application on an Android phone

查看:292
本文介绍了调试在Android手机上的ASP.NET MVC应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目的

我在寻找最简单的,可能的,一步一步的安装过程中使用我的IP地址作为URL调试我的ASP.NET MVC 4应用程序。我希望能够从我的Andr​​oid手机,这是连接到我通过Wi-Fi无线局域网络访问应用程序,使用计算机的本地IP地址(例如: - http://192.168.1.109:25968 )。我RC在Windows 7上运行Visual Studio 2012。

I'm looking for the simplest-possible, step-by-step setup process for debugging my ASP.NET MVC 4 application using my IP address as the URL. I want to be able to access the application from my Android phone, which is connected to my local network via Wi-Fi, using my computer's local IP address (e.g. - http://192.168.1.109:25968). I'm running Visual Studio 2012 RC on Windows 7.

此问题已得到解决,另外两个问题(这个和的这个),但答案是极简,不帮助我的人。我不得不通过敲打我的电脑上,盲目地改变,直到努力的东西每个设置之前解决这个问题。我不希望有经历一遍。我想知道我在做什么这一次。

This question has been addressed by two other questions (this one, and this one), but the answers are extremely brief and aren't helping me at all. I've had to resolve this issue before by banging on my computer and mindlessly changing every setting until something worked. I don't want to have to go through that again. I want to understand what I'm doing this time.

设置信息

该项目仅仅是一个默认的ASP.NET MVC 4 Internet应用程序。我是pretty的肯定,我并没有改变任何事情。

The project is just a default ASP.NET MVC 4 Internet Application. I'm pretty sure I haven't changed anything yet.

在我的应用程序属性中的Web选项卡设置为使用本地IIS Web服务器,我有使用IIS前preSS检查。该项目的URL是的http://本地主机:25968 / 。我看到locahost有可能是一个问题,但VS不会让我把在一个IP地址或通配符。

The Web tab in my application's Properties is set to "Use Local IIS Web Server", and I have "Use IIS Express" checked. The Project url is http://localhost:25968/. I see that the "locahost" there might be a problem, but VS won't let me put in an IP address or wild cards.

是我的IIS前$ P $我的应用程序PSS ApplicationHost.config文件如下:

My IIS Express applicationhost.config file for my application are as follows.

<site name="APPLICATION_NAME" id="13">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\USERNAME\Documents\Visual Studio 11\Projects\APPLICATION_NAME" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:25968:localhost" />
    </bindings>
</site>

这是怎么回事

当我连接到从主机的网站与的http://本地主机:25968 它的伟大工程。如果我尝试使用 http://192.168.1.109:25968 从主机,我得到错误的请求 - 无效的主机名,HTTP错误400请求的主机名无效。从另一台计算机在网络上使用此相同的URL,它只是超时。

When I connect to the site from the host computer with http://localhost:25968 it works great. If I try to use http://192.168.1.109:25968 from the host computer, I get "Bad Request - Invalid Hostname, HTTP Error 400. The request hostname is invalid." Using this same URL from another computer on the network, it just times out.

推荐答案

授予自己两者结合本地主机和通配符的网络适配器,配置IIS防爆preSS绑定到他们,并打开端口的防火墙的权限。通过使用通配符,您不必重新配置时,您的IP地址更改。

Grant yourself permission to bind to both localhost and wildcard network adapters, configure IIS Express to bind to them, and open the port on your firewall. By using a wildcard, you don't have to reconfigure when your IP address changes.

步骤详细信息:(他们承担的5555端口号 - 用你的实际端口代替)

Step details: (they assume a port number of 5555 - use your actual port instead)

  1. 从命令提示符管理员以下命令:

  1. Run these commands from a command prompt as Administrator:

netsh http add urlacl url=http://localhost:5555/ user="NT AUTHORITY\INTERACTIVE"
netsh http add urlacl url=http://*:5555/ user="NT AUTHORITY\INTERACTIVE"

  • .VS \设置\对ApplicationHost.config 的(或pre-VS2015,%USERPROFILE%\文档\ IISEx preSS \设置\ applicationhost的.config 的),添加一个通配符结合到你的网站。其结果应该是这样的:

  • In .vs\config\applicationhost.config (or for pre-VS2015, %USERPROFILE%\Documents\IISExpress\config\applicationhost.config), add a wildcard binding to your site. The result should look like this:

    <site name="..." id="...">
        <!-- application settings omitted for brevity -->
        <bindings>
            <binding protocol="http" bindingInformation="*:5555:localhost" />
            <binding protocol="http" bindingInformation="*:5555:*" />
        </bindings>
    </site>
    

  • 打开防火墙端口您的IIS防爆preSS网站。您可以从管理命令提示符下执行此操作:

  • Open the firewall port for your IIS Express site. You can do this from an administrative command prompt:

    netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=5555 profile=private remoteip=localsubnet action=allow
    

  • 这篇关于调试在Android手机上的ASP.NET MVC应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆