[英]How can i call my node js sever method on vm server from my local machine through ip address?
我有 node.js 服務器,它托管在 IIS 的 vm 服務器上。
我想通過本地機器 IP 地址和端口使用 asp.net 從我的本地機器調用此節點服務器 API,但我啟用調用此 node.js API。 我在我的代碼下面張貼:
// 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();
您需要提供完整的 IP 地址和端口號,而不僅僅是213.*.*.*:Port
。
登錄到您的虛擬機並找出 IP 地址。 對於端口,從您的代碼中可以看出您正在偵聽的端口(通常為 3000)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.