相关疑难解决方法(0)

Node.js本机模块不是有效的Win32应用程序错误

尝试为node.js创建Hello World本机模块

在VS 2012中获得了一个带有一个文件的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)
Run Code Online (Sandbox Code Playgroud)

那个编译成hello.node.
选项:
- 动态库(.dll)
- 无公共语言运行时支持

使用它像:

hello = require './hello'
console.log hello.hello()
Run Code Online (Sandbox Code Playgroud)

它适用于本地机器(win8 x64,节点:0.8.12)
但是在远程服务器(Windows Server 2008 x64,节点:0.8.12,iisnode:0.1.21 x64,iis7)上它会抛出此错误:

应用程序抛出未捕获的异常并终止:错误:
%1不是有效的Win32应用程序.

位于Function.Module的Module.load(module.js:356:32)的
Object.Module._extensions..node(module.js:485:11)的C:\ inetpub\test\lib\server\hello.node . _load(module.js:312:12) 在Module.require(module.js:362:17) at的require(module.js:378:17) 处.(C:\ inetpub\test\lib\server\index.js:32:9) 在Module._compile(module.js:449:26) 处于Object.Module._extensions..js(module.js:467:10) ) 在Function.Module._load的Module.load(module.js:356:32) 处(module.js:312:12)








我尝试过:
使用应用程序池设置(启用win32应用程序)没有帮助.
Iisnode x86不安装在x64操作系统上.
由于错误,无法编译为x64:错误2错误LNK1112:模块机器类型'X86'与目标机器类型'x64'冲突C:\ derby\hello\build \node.lib(node.exe)hello

有没有人有什么建议?

native node.js iisnode

15
推荐指数
1
解决办法
3万
查看次数

标签 统计

iisnode ×1

native ×1

node.js ×1