简体   繁体   English

从Android设备访问本地主机网站

[英]Access local host website from Android Device

I have created web services application in asp.net mvc and now need to access it from my Android device connected on same network. 我已经在asp.net mvc中创建了Web服务应用程序,现在需要从连接在同一网络上的Android设备访问它。 This is needed to debug webservies application. 这是调试Webservies应用程序所必需的。 I do not have a static IP. 我没有静态IP。 The site is running with url http://localhost:27719 but I cannot access localhost from Android device. 该站点使用url http:// localhost:27719运行,但是我无法从Android设备访问localhost。 I researched web and tried below options: Tried changing website binding information in applicationhost.config file. 我研究了Web并尝试了以下选项:尝试更改applicationhost.config文件中的网站绑定信息。 But I couldn't find my webstie entry in applicationhost file. 但是我在applicationhost文件中找不到我的webstie条目。 I have also tried opening the specific port 27719 in windows firewall. 我也尝试在Windows防火墙中打开特定的端口27719。 But that isn't working too. 但这也不起作用。 I am able to access website if I host on IIS. 如果我在IIS上托管,则可以访问网站。 But I need to access it when I run from Visual Studio, so that I can debug. 但是,当我从Visual Studio运行时,我需要访问它,以便进行调试。 Please suggest how can I access webservices on my machine from Android device connected to same wifi network. 请提出如何从连接到同一WiFi网络的Android设备访问机器上的Web服务的建议。

In the menu at the top of the window in Visual Studio, go to Debug, then Attach to Process (alternatively, press Control Alt P on your keyboard). 在Visual Studio窗口顶部的菜单中,转到“调试”,然后“附加到进程”(或者,按键盘上的Control Alt P )。 It will ask you which process to attach to. 它将询问您要附加到哪个进程。 Choose w3wp.exe and press Attach. 选择w3wp.exe,然后按Attach。 The debugger will then connect to your site in IIS, and you'll be able to debug when the Android device is connected to the site. 然后,调试器将连接到IIS中的站点,并且当Android设备连接到站点时,您将能够进行调试。

It should be noted that you'll need to provide the IP of the server in the URL on your Android device, not "localhost". 应该注意的是,您需要在Android设备上的URL中提供服务器的IP,而不是“ localhost”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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