2012-04-28 5 views
4

私はすべてのモジュールをインストールして、CMDを使用してこのスクリプトを実行する必要があります。このスクリプトをwebmatrixを通じてnode.jsで実行しているとき:このスクリプトを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のテンプレートを試しましたが、うまくいきます。

+0

さて、あなたは 'application'の代わりに' app'を試しましたか?それがエラーの内容です。 – pimvdb

+0

また、http://expressjs.com/guide.htmlの例を使用する方が簡単です。 –

+0

申し訳ありませんが、もう一度ご確認ください。 – user1362630

答えて

2

iisnodeでアプリケーションを使用するには、iisnodeで提供されているポート/ソケットを使用する必要があります(この場合は、IISをノードにバンドルされているWebサーバーとして使用しています)。

最後の行をapp.listen(process.env.port || 2455);に置き換えます。したがって、node.exe app.jsで実行すると、iisnodeとうまく動作し、ポート2455で使用できるようになります。

1

使用

app.listen(process.env.port || 2455)。代わり

app.listen(PORTNO) `の

原因はiisnode Webサーバーです。

関連する問題