我在尝试通过 iisnode 使用 node-oracle 运行 Node.js 服务器时遇到问题。iisnode 示例都可以正常工作,并且在命令行窗口中运行服务器 [在不同的端口上] 可以完美运行。服务器设置基于“The Node Beginner Book”示例(即 index.njs -> server.njs -> router.njs -> requesthandlers.njs)。我将所有节点文件重命名为 *.njs,并且当前为 iisnode 设置了 web.config 以处理该扩展名的所有文件,并使用重写规则将传入请求转发到 index.njs。当 node-oracle(在 requesthandlers.njs 中使用)尝试调用 oracle_bindings.node 时,就会出现问题:
Application has thrown an uncaught exception and is terminated:
Error: The specified module could not be found.
c:\Program Files\iisnode\www\Reports\node_modules\oracle\build\Release\oracle_bindings.node
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (c:\Program Files\iisnode\www\Reports\node_modules\oracle\lib\oracle.njs:2:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
我已经为 .\iisnode\www\Reports\node_modules\oracle 路径中可以想象的每个文件夹上的 IIS_IUSRS 组授予了读/写/执行权限。我也尝试过Node cannot find modules in IIS, can find from prompt无济于事的解决方法。虽然我可能只是将服务器设置为服务,但我更喜欢通过 IIS 来使用它,这样我就不必在支持 IE9 的同时与 CORS 进行斗争。非常感谢任何帮助,谢谢!