这可能是一个非常简单的问题,但我可以在Windows Server 2008环境中使用node.js与IIS? 有没有一个“微软”图书馆或其他解决scheme效果更好?
演练用于设置Windows + IIS + Node.js + Mongodb来构建一个快速的待办事项应用程序
http://www.amazedsaint.com/2011/09/creating-10-minute-todo-listing-app-on.html
当然你可以看看IISNode项目 。
你可以在Windows上安装Node.js,但它是它自己的服务器,所以除非你使用IIS作为它的代理,否则根本就不需要IIS。 但请注意,以下是从Node.js的安装说明中引用的 :
[Windows]版本都不是令人满意的稳定版本,但可以运行。
我一直在使用Cygwin的Windows上的节点,并没有什么问题。 您可以使用IIS在默认端口80上运行,并在不同端口上运行您的Node应用程序。
如果你想代理,那么大多数都使用Nginx。
你基本上有两个路由通过IIS运行一个Node.js应用程序。
如果您将整个应用程序专用于Node.js,并且只需要面向公共端点来处理现有的IIS应用程序,则我会建议使用ARR来路由整个站点。 我为几个项目做了这个,而且工作得很好。
说实话,我不喜欢IISNode,因为它看起来像你在节点代码与IIS的异端。 它的工作原理,如果你特别针对Azure,它可能是你最好的选择。 如果您必须将其放入现有的.Net应用程序中,它也可能是最好的选择。
您可以在Windows上构建 node.js,但由于可能的稳定性问题,建议不要使用它。 如果IIS使用基于线程的池,那么对于node.js,您甚至不应该将其用作node.js的反向代理 (在基于Linux的系统上,nginx通常用于执行此操作),因为池可能会很快完全加载。 如果你想在窗口上类似于node.js的东西,那么你应该尝试看manos 。
现在有一些很好的文章:
在Windows的IIS中安装和运行node.js应用程序 – 你疯了吗?
在Windows上的IIS中承载node.js应用程序
甚至有一些样本的github项目:
https://github.com/tjanczuk/iisnode/tree/master/src/samples
https://github.com/tjanczuk/iisnode
我想尽可能的简单。
我安装了iisnode并且运行了没有问题的示例,但是…
我试图用iisnode在IIS上部署它,但是我不得不捆绑我的流星应用程序,然后将其作为节点应用程序进行部署。 我遇到的问题使我感到灰心。 我根本无法安装fibers
。 编译过程中不断出现错误,所以我放弃了。
我为我解决这个问题是在IIS上使用反向代理。
在流星论坛上看到我的帖子
我的最终web.config条目是:
我做了同样的,但是,我有IIS上的反向代理使用域上的子文件夹的方式扔我。
我不知道通过使用ROOT_URL我们可以指定一个子路径。
例如,如果我在我的流星应用程序文件夹中运行以下命令:
set ROOT_URL=http://localhost:3100/n/todos && meteor
我将可以通过
http://localhost:3100/n/todos
访问我的应用程序,注意我省略了/
。 如果我们尝试冲浪到地址http://localhost:3100/n
或http://localhost:3100/
将给我们一个错误Unknown path
。所以,当我第一次设置反向代理时,我每次都得到
Unknown Path
错误。原来,在我的IIS配置中,我必须指定
http://localhost:3100/n/todos
作为动作的url值,请注意最后的“n / todos” 。所以我的重写规则就这样结束了:[file @ c:/inetpub/wwroot/web.config]
``` <configuration> <system.webserver> <rewrite> <rules> <rule name="TODOs meteor app. Route the requests" stopProcessing="true" enabled="true"> <match url="^n/todos/(.*)" /> <conditions> <add input="{CACHE_URL}" pattern="^(https?)://" /> </conditions> <action type="Rewrite" url="{C:1}://localhost:3100/n/todos/{R:1}" /> <!-- I was missing the /n/todos here --> <serverVariables> <set name="HTTP_ACCEPT_ENCODING" value="" /> </serverVariables> </rule> </rules> <outboundRules> <rule name="TODOs ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="false"> <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://localhost:3100/(.*)" /> <action type="Rewrite" value="/n/todos/{R:2}" /> </rule> <rule name="TODOs RewriteRelativePaths" preCondition="ResponseIsHtml1" enabled="false"> <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" negate="false" /> <action type="Rewrite" value="/n/todos/{R:1}" /> </rule> <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1"> <match filterByTags="A, Form, Img" pattern="^http(s)?://localhost:3100/(.*)" /> <action type="Rewrite" value="http{R:1}://localhost/{R:2}" /> </rule> <preConditions> <preCondition name="ResponseIsHtml1"> <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /> </preCondition> </preConditions> </outboundRules> </rewrite> </system.webserver> </configuration> ```
谢谢