【发布时间】:2017-08-29 08:12:52
【问题描述】:
我在 Windows 上有一个 Azure Web 应用程序,它运行 iisnode 以与我的 Node 应用程序通信,我收到一个 500 错误,子状态为 1001。似乎 IIS 似乎没有从 Node.js 获得响应。我在应用程序设置下设置了 NODE_ENV 和 PORT 变量。为了最小化变量,我还将其简化为 Node Hello World 应用程序。据我所知,Node 获取 PORT 变量并使用正确的端口启动,因为我看到标准输出表明应用程序在指定的端口上启动。但是,当我尝试任何请求时,Node 似乎从未真正收到来自 iisnode 的请求。如果我尝试 console.log 一条消息,我什么也得不到,而且我没有看到任何异常,如果它是在事情的响应方面,我希望是这种情况。我已经以相同的方式设置了其他应用程序服务,这似乎工作正常。我尝试从其中一个部署代码,但我得到了相同的行为。
我正在尝试使用以下代码进行最基本的测试
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
console.log('Getting Response');
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
var port = process.env.PORT || '3003';
server.listen(port);
// Put a friendly message on the terminal
console.log("Server running on port " + port);
我收到了Server running on port 8080 的回复,这让我相信服务器可以正常启动。但是,我只是在浏览器中得到友好的 500.1001 响应。从我的角度来看,当它的设置与我们正在运行的许多其他网站相同时,有什么想法会导致这种情况吗?
【问题讨论】: