小编Vla*_*aev的帖子

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万
查看次数

iis7 为 node.js 站点随机返回 404 not found 错误

服务器,位于德国
Windows Server 2008 / IIS 7
node.js 0.8.22
iisnode 0.2.2 x64

网页配置

<configuration>
  <system.webServer>
    <handlers>
      <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
    </handlers>

    <rewrite>
      <rules>
        <rule name="DynamicContent">
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
          </conditions>
          <action type="Rewrite" url="server.js"/>
        </rule>
      </rules>
    </rewrite>

    <iisnode watchedFiles="*.js;lib\*;node_modules\*;styles\*;ui\*;views\*" />

  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

服务器.js

var port = process.env.NODE_ENV == 'production' ? process.env.PORT : 3000;

require('./lib/server').listen(port);
Run Code Online (Sandbox Code Playgroud)

网站链接

问题:
有时我会收到 200 响应,但有时会收到 404(找不到文件或目录)。

如果我确实从俄罗斯、德国或美国请求,响应是 200。
如果我从中国请求,有时响应是 404(取决于 ISP、时间和其他方面)。

404 响应看起来像 iis 找不到 server.js

200 响应示例(使用 express Vpn,连接到美国):

<configuration>
  <system.webServer>
    <handlers>
      <add …
Run Code Online (Sandbox Code Playgroud)

iis iis-7 node.js iisnode

6
推荐指数
1
解决办法
2219
查看次数

IIS 7 查询字符串长度

我正在使用 Asp Net Mvc 4 Web Api,我需要发出查询字符串长度 > 2000 个符号的请求

我已经在 web.config 中设置了 maxQueryStringLength="10000" 参数。在我的开发机器上一切正常 在 IIS 上,仅当查询字符串 < 2000 个符号时它才有效,但如果查询字符串 > 2000 个符号,我会收到错误: 404 Not Found

有什么注意事项吗?

iis asp.net-web-api

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

标签 统计

iis ×2

iisnode ×2

node.js ×2

asp.net-web-api ×1

iis-7 ×1

native ×1