简体   繁体   中英

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 .

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. 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 .

Log into your Vm and find out the IP address. For the port this should be obvious from your code what port you are listening on (typically 3000).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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