我已经安装了使用 CMD 运行此脚本所需的所有模块。当我通过 webmatrix 在 node.js 中运行此脚本时:
var http = require('http');
var everyauth = require('everyauth');
var app = require('express').createServer();
app.get('/', function(request, response) {
response.send('Hello Express!!');
});
app.listen(2455);
它不起作用。错误是:
iisnode encountered an error when processing the request.
HRESULT: 0x2
HTTP status: 500
HTTP reason: Internal Server Error
You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'.
In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem.
The node.exe process has not written any information to the stdout or stderr.
我已经尝试使用来自博客的不同脚本,但它们不起作用。我在 webmatrix 中尝试了 Steven Sanderson 的模板,它确实有效。
最佳答案
要将您的应用程序与 iisnode 一起使用,您必须使用 iisnode 提供的端口/套接字(因为在这种情况下,您使用 IIS 作为网络服务器,而不是 Node 中捆绑的网络服务器)。
将最后一行替换为 app.listen(process.env.port || 2455);
,这样它既可以很好地与 iisnode 配合使用,又可以在使用 运行时在端口 2455 上可用>node.exe app.js
.
关于javascript - 我如何在 node.js 中运行这个脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10362082/