node.js用のHelloWorldネイティブモジュールを作成しようとしています
1つのファイルでVS2012のWin32プロジェクトを取得しました。
#include <node.h>
#include <v8.h>
using namespace v8;
Handle<Value> Method(const Arguments& args) {
HandleScope scope;
return scope.Close(String::New("world"));
}
void init(Handle<Object> target) {
target->Set(String::NewSymbol("hello"),
FunctionTemplate::New(Method)->GetFunction());
}
NODE_MODULE(hello, init)
これはhello.nodeにコンパイルされます。
オプション:
-ダイナミックライブラリ(.dll)
-共通言語ランタイムのサポートなし
次のように使用します。
hello = require './hello'
console.log hello.hello()
ローカルマシン(win8 x64、ノード:0.8.12)
で動作しますが、リモートサーバー(Windows Server 2008 x64、ノード:0.8.12、iisnode:0.1.21 x64、iis7)では次のエラーがスローされます。
アプリケーションがキャッチされない例外をスローし、終了しました:エラー:
%1は有効なWin32アプリケーションではありません。C:\ inetpub \ test \ lib \ server \ hello.node
at Object.Module._extensions..node(module.js:485:11)
at Module.load(module.js:356:32)atFunction.Module
。 _load(module.js:312:12)
at Module.require(module.js:362:17)
at require(module.js:378:17)atObject
。(C:\ inetpub \ test \ lib \ server \ index.js:32:9)
at Module._compile(module.js:449:26)
at Object.Module._extensions..js(module.js:467:10 )
at Module.load(module.js:356:32)
at Function.Module._load(module.js:312:12)
私が試したこと:
アプリプール設定で遊ぶ(win32アプリを有効にする)ことは役に立ちませんでした。
Iisnodex86はx64OSにインストールされません。
エラーのためx64にコンパイルできません:エラー2エラーLNK1112:モジュールマシンタイプ'X86'がターゲットマシンタイプ'x64'と競合していますC:\ derby \ hello \ build \ node.lib(node.exe)hello
誰か提案はありますか?