简体   繁体   English

如何通过ip地址从本地机器调用vm服务器上的node js服务器方法?

[英]How can i call my node js sever method on vm server from my local machine through ip address?

I have node.js server that is hosted on vm server in IIS .我有 node.js 服务器,它托管在 IIS 的 vm 服务器上。

I want to call this node server API from my Local machine using asp.net through local machine IP address and port but I enable to call this node.js API.我想通过本地机器 IP 地址和端口使用 asp.net 从我的本地机器调用此节点服务器 API,但我启用调用此 node.js API。 I posted below my code :我在我的代码下面张贴:

// below this is my node js sever js api method
app.get("/stream", function (request, response) {

});

// below code for call node.js sever api method from local machine
string url = "http://213.*.*.*:Port/stream";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

You need to provide a full IP address and port number, and not just 213.*.*.*:Port .您需要提供完整的 IP 地址和端口号,而不仅仅是213.*.*.*:Port

Log into your Vm and find out the IP address.登录到您的虚拟机并找出 IP 地址。 For the port this should be obvious from your code what port you are listening on (typically 3000).对于端口,从您的代码中可以看出您正在侦听的端口(通常为 3000)。

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

相关问题 如何从服务器获取我的Corba客户端的IP地址 - How do I get the IP address of my Corba client from the sever C# - 查找我机器的本地 IP 地址而不是 VM - C# - Finding my machine's local IP Address and not the VM's 仅从本地计算机成功连接我的WCF服务,除非指定了计算机IP地址而不是本地主机 - Succeed to connect my WCF service only from local machine unless machine ip address is specified instead of localhost 如何在客户端程序中指定服务器IP地址? - How do I specify Server Ip address in my Client program? 如何获得3G调制解调器的IP地址? - How can i get IP Address of my 3G modem? 如何从绑定中调用方法并在iOS中重写? - How can I call a method from my bindings and override in iOS? 如何每隔2小时(定期)将文件从Azure文件存储复制到本地计算机? - How can I copy files from Azure File storage to my local machine every 2 hours (periodically)? 通过我本地计算机上的 .NET Windows 应用程序将文件从一台服务器复制到另一台服务器 - Copying files from one server to another through a .NET Windows application on my local machine 如何从aspx网页在客户端计算机上调用Win应用程序? - How can I call a win app on client machine from my aspx web page? 如何确定我的计算机的IP地址是否在指定的网络地址之下? - How can I determine if my computer's IP address falls under a specified network address?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM