简体   繁体   English

无法使用IP地址连接到Web服务,但可与127.0.0.1一起使用

[英]Cannot connect to webservice using the ip address but works with 127.0.0.1

Currently I have webservice using dnx hosted on a specific ip address and connecting to it works fine. 目前,我已经在特定的IP地址上托管了使用dnx的网络服务,并且可以正常连接。 The service is listening at port 5004 so inorder to connect to it I use the following format 该服务正在侦听端口5004,因此为了连接到该端口,我使用以下格式

http://192.X.X.12:5004/api/somePar/?...

Now I moved the webservice to Azure and I use the following address to Remote Desktop onto the virtual machine on which it is hosted. 现在,我将Web服务移至Azure,并使用以下地址将远程桌面移至托管该服务的虚拟机上。

http://MyLink.cloudapp.net:54254

Now I am attempting to connect to it using its web address.Inside the virtual machine where the weservice is hosted if I type 现在我尝试使用其网址连接到它。如果键入,则在托管weservice的虚拟机内部

http://127.0.0.1:5004/api/somePar/?..  (WORKS)

The above works. 以上作品。 The ipconfig of the machine gives me say ABCD If I use that as such it fails. 这台机器的ipconfig给我说ABCD,如果我这样使用它会失败。

http://A.B.C.D:5004/api/somePar/?..   

I guess that is another reason why my other machines cant connect to the webservice hosted on that machine. 我猜这是我的其他机器无法连接到该机器上托管的Web服务的另一个原因。 Any suggestions on why the ip address of the machine fails and the webservice only works with 127.0.0.1 How can I fix this ? 关于为什么计算机的IP地址失败并且Web服务仅与127.0.0.1一起使用的任何建议,如何解决此问题?

What OS is the virtual machine running? 虚拟机正在运行什么操作系统? I had this exact problem with a machine running Windows 7 Professional; 我在运行Windows 7 Professional的计算机上遇到了这个确切的问题; apparently, if you're running Windows on that VM, it needs to be Windows Server. 显然,如果您在该VM上运行Windows,则它必须是Windows Server。

Check the binding, it should specify All Unassigned . 检查绑定,应指定All Unassigned

And try changing your port to 80 because 5004 is Real-time Transport Protocol used by Real Time Streaming Protocol (RTSP) for Microsoft Windows Media streaming services and some other things and may be locked . 尝试将端口更改为80,因为5004是用于Microsoft Windows Media流服务的实时流协议(RTSP)使用的实时传输协议,并且可能已被锁定

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

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