我如何在node.js中运行这个脚本?

我已经安装了所有需要使用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. 

我尝试了不同的博客不同的脚本,但他们不工作。 我尝试了Steven Sanderson在webmatrix中的模板,这确实有效。

要在iisnode上使用你的应用程序,你必须使用iisnode提供的端口/套接字(因为在这种情况下,你使用IIS作为web服务器,而不是捆绑在节点中的)。

将最后一行replace为app.listen(process.env.port || 2455); ,这样它就可以和iisnode一起使用,并且可以在运行node.exe app.js 2455端口上使用。

使用

app.listen(process.env.port || 2455);

而不是`

app.listen(PORTNO);

因为它是iisnodenetworking服务器。