[英]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.