从android通过wifi访问本地主机 [英] accessing localhost from android over wifi

查看:173
本文介绍了从android通过wifi访问本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



对于测试,我想通过WiFi访问该网络服务。

$ b我已经写了一个Https webservice,所以它是使用SSL加密的。
$ b

编辑示例:我的网络服务正在VM号码111上运行,我想通过wifi访问,所以地址将是 https://VM111/Webservice/service.svc 。我可以从WiFi网络中的任何一台笔记本电脑进行访问,但不能从Android手机访问,这是我的问题。



有没有办法从Android手机访问虚拟机的本地主机,有没有人处理过?



我的看法是与域名有关,因为每个其他设备都在Active Directory中。



如果对我的问题有任何疑问很高兴回答他们,

解决方案

您可以在本地主机上的特定端口上获取运行在您的服务器上的公用URL。



在我的工作地点,我可以通过使用我的机器的本地IP地址访问本地服务器,因为大多数其他答案建议。但是在家里,我无法通过某种原因做到这一点。在尝试了许多答案并花了很多个小时后,我发现了 https://ngrok.com 。这是很直接的。只需从文件夹中下载即可:

  ngrok portnumber 

(从Windows中的命令提示符)

  ./ ngrok portnumber 

(从linux终端)



将为本地服务器上的本地服务器提供公共URL,该服务器在本地主机上运行该端口号。您可以在您的应用程序中添加并使用该URL进行调试。



您可以将本地Web服务器安全地暴露在互联网上,并捕获所有流量以进行详细检查。您可以与您的同事开发人员共享URL,该用户可能正在远程工作,并可以调试App / Server交互。



希望这有可能节省某人的时间。

I have written a Https webservice, so it is encrypted with SSL.

For testing i would like to acces that webservice over wifi.

edit Example: My webservice is running on a VM number 111, i want to acces it over wifi so the adress would be https://VM111/Webservice/service.svc. I can acces it from any laptop in the wifi network but not from the Android Phone, that is my problem.

Is there a way to acces the localhost of the VM, from the Android phone, and has anyone dealt with this before?

My gues is that is has something to do with domains because every other device is in the Active directory.

If there are any questions about my question i am glad to answer them,

解决方案

You can get a public URL for your server running on a specific port on localhost.

At my work place I could access the local server by using the local IP address of my machine in the app, as most of the other answers suggest. But at home I wasn't able to do that for some reason. After trying many answers and spending many hours, I came across https://ngrok.com. It is pretty straight forward. Just download it from within the folder do:

ngrok portnumber

( from command prompt in windows)

./ngrok portnumber

(from terminal in linux)

This will give you a public URL for your local server running on that port number on localhost. You can include in your app and debug it using that URL.

You can securely expose a local web server to the internet and capture all traffic for detailed inspection. You can share the URL with your colleague developer also who might be working remotely and can debug the App/Server interaction.

Hope this saves someone's time someday.

这篇关于从android通过wifi访问本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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