- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我发现 iisnode 比使用 node 命令慢。
有很多benefits使用 iisnode,但性能很差。
我正在使用来自 here 的配置文件.
知道如何加快速度吗?
更新:
我注意到每个页面调用都会重新连接一个新的 mongodb 连接。
我该如何预防?
最佳答案
此处提示在 Windows 64 位服务器上将 Node.js 与 IIS7 集成。以下提示还解决了 iisnode 的一些性能不佳问题,并演示了如何使用 Node.js Native Extensions。
总结:
Create a new Unmanaged Integrated 32-bit Application Pool dedicated for node.js. No other applications should use this pool.
这也适用于 64 位,但一些 node.js native 扩展如 Coconut2D 需要 32 位,因为 SQLite 包装。如果您不使用 native 扩展,那么您可以一直使用 64 位!
下载:iisnode-core-iis7-v0.1.19.0-x64.msi
。
使用此命令安装它:msiexec/i iisnode-core-iis7-v0.1.19.0-x64.msi WOW=1
。这将在 64 位计算机上安装 32 位版本的 iisnode。请注意,iisnode.dll
将安装在 C:\Program Files (x86)\iisnode\iisnode.dll
中。
下载 32 位版本的 node.js(例如 node-v0.12.0-x86.msi
)并将其安装到 C:\nodejs
创建一个新的应用程序池
Name: node.jsManaged pipeline mode: Integrated
.NET Framework Version: No Managed CodeEnable 32-Bit Applications: TrueIdentity: administrator
Assuming your Node.js Server Script file is server.js
. Go the the web folder and create file node_start.cmd
. In the command file you should change the current path to your wwwroot
and start node.js with your server.js
file. You should use double quoted paths.
C:cd "C:\HostingSpaces\...\wwwroot""C:\nodejs\node.exe" "C:\HostingSpaces\...\wwwroot\server.js"
In your server.js
make sure you have process.env.PORT
var http = require('http');http.createServer(function (req, res) { ... your code here ...}).listen(process.env.PORT);
(Optional) If you are using any node.js Native Extensions such as Coconut2D, SQLite, Cairo or WebKit modules, you must copy the *.node
files and DLLs in your wwwroot\node_modules
folder. Make sure you also set NTFS security to allow execution of those files or elevate the Application Pool to impersonate the Administrator. To load the native extensions use require()
as shown below.
var http = require('http');var Coconut2D = require("Coconut2D.node");http.createServer(function (req, res) { ... your code here ...}).listen(process.env.PORT);
Place the following web.config
in your web root (eg. C:\HostingSpaces\...\wwwroot
). This will enable IIS7 to process any non-node files such as images, static html files and xml files, and let node.js handle only its own server-side scripts.
Having IIS handling static files and running server-side scripts on node.js side-by-side is a highly recommended practice and really boosts the performance of your web sites.
In this example I am handling .asp
files with iisnode
by using a Rewrite Rule. Replace *.asp*
with your node.js server script extension (eg. *.njs*
). Note that there is not a root slash in the wildcard pattern; this is important as well as the last *
at the end of the pattern.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="node.js" verb="*" modules="iisnode" />
</handlers>
<iisnode nodeProcessCommandLine=""C:\...\start_node.cmd"" />
<defaultDocument>
<files>
<remove value="index.php" />
<remove value="default.aspx" />
<remove value="iisstart.htm" />
<remove value="index.html" />
<remove value="index.htm" />
<remove value="Default.htm" />
</files>
</defaultDocument>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
<rewrite>
<rules>
<rule name="CavoBoutique" patternSyntax="Wildcard">
<match url="*.asp*" />
<action type="Rewrite" url="node.js" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
关于node.js - iisnode 性能很慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28722090/
在 Server 2008 R2 64 位、IIS 7.5、iisnode 0.2.4.0、node.js 0.10.5 上出现此错误 - HTTP 错误 500.21 - 内部服务器错误 处理程序“
我有一个运行良好的简单服务器(如下),问题是 process.env.PORT 的值不是我预期的数字,而是一个字符串值,如 "\\.\pipe\d226d7b0-64a0- 4d04-96d4-a75
我的iisnode在win8/IIS8上运行顺利。我创建了一个非常简单的 hello world 并且效果很好。但是,当我尝试使用 process.stdin 时,出现以下错误: Applicatio
我正在使用带有 IIS (IISNode) 的 Node JS 和 Microsoft 的 MS SQL 驱动程序包 (MSNodeSQL) 创建一个 http 服务器。当通过 http 服务器访问我
我正在尝试使用 GitHub webhooks 和 node.js 构建自动代码拉取服务。当我昨天运行这段代码时,它就像一个魅力,并将正确的存储库拉到正确的文件夹中,但今天它开始默默地失败。它可以在我
我运行 Node.js 应用程序并遇到严重错误 iisnode encountered an error when processing the request. HRESULT: 0x2 HTTP
我发现 iisnode 比使用 node 命令慢。 有很多benefits使用 iisnode,但性能很差。 我正在使用来自 here 的配置文件. 知道如何加快速度吗? 更新: 我注意到每个页面调用
我敢肯定这个问题已经被问过一百万次了,但到目前为止我还没有找到解决以下问题的方法。 我有一个使用 nodejs 和 express 运行的基本应用程序。当我在 Node 中运行应用程序时,它默认将我发
我有这个小服务器,它在 iisnode 上运行良好: 索引.js var express = require('express') var app = express() var port = pro
当我对 app.js 文件进行更改并保存时,即使在默认的 60,000 毫秒之后,我的 node.js 应用程序似乎也不会自动更新。我错过了什么吗? 最佳答案 您可以尝试在iisnode.yml(ht
我正在努力让 IISNode 默认为我的 Node 应用程序提供主 server.js 应用程序文件,此时如果我浏览到 http://localhost:80/我的应用程序运行的地方只是列出了应用程序
当使用 IISNode 在 IIS 上为 NodeJS 应用程序提供服务时,将托管管道设置为经典还是集成更好? 最佳答案 如果您不使用任何 ASP.NET,则可以安全地使用其中任何一个并禁用 ASP.
我正在尝试使用 iisnode 运行 express。我按照提供的示例进行操作,但是当尝试将最新的 Express 版本与基本示例一起使用时,无法使其正常工作。 我遇到错误 Cannot GET/no
有谁知道一种方法可以让一个 JavaScript 文件或一组文件始终在 IISNode 下运行而不需要客户端请求?这个想法是让脚本充当服务,但让它们在 IISNode 下运行。 谢谢!csh3 最佳答
我的网站在 express 中运行。但现在我需要在 IIS 上托管它。如何让我的路由与 IISNode 一起工作? 我能够将我的静态内容移动到/public 文件夹(html、前端 js 等)。我不想
我知道我可以使用 web.config。 指定一个环境 node_env 变量,它可以通过 process.env.node_env 在服务器端 *.js 文件中访问。 但是,例如我想访问另一个环境
我通过使用 iisnode 将 Node 与 IIS 结合使用. 我觉得以前在 Node 中配置服务器的事情现在可以直接在 IIS 中完成。 比如: https 配置(和证书) http 到 http
使用 Powershell cmdlets for Node on Azure, 时特别是 Add-AzureNodeWebRole,您将获得所有设置的启动任务,以将 iisnode 部署到您的 Az
IISNode 与 NodeJS 结合,会不会因为 IIS 本身在 NodeJS 面前就是一个阻塞进程,所以 NodeJS 就变成了一个阻塞进程? 最佳答案 本文中的“阻塞”指的是 I/O。 IIS
我在 Windows 2008 R2 和 Node 0.8 上使用 IISnode 0.1.21 x64 我的应用程序已成功运行 4 个线程。但一段时间后(例如 3-4 小时),响应无法从 IISno
我是一名优秀的程序员,十分优秀!