当从node.js切换到iisnode时,有什么改变?
我一直在尝试在iisnode上运行节点应用程序。 这个应用程序运行在node.js顺利,没有问题。 但是,我需要将此应用程序集成到一个asp.net应用程序,因此我一直在尝试使用iisnode在iis上运行此应用程序! 但我一直面临一些困难! 我想知道是否有什么需要改变在config或server.js文件,使其工作?
谢谢 !
节点应用程序中唯一需要的更改将是端口号 – 在官方的/src/samples/express/hello.js中指出,在server.js / app.js中使用process.env.PORT
值而不是特定的数字(请注意最后一行):
var express = require('express'); var app = express.createServer(); app.get('/node/express/myapp/foo', function (req, res) { res.send('Hello from foo! [express sample]'); }); app.get('/node/express/myapp/bar', function (req, res) { res.send('Hello from bar! [express sample]'); }); app.listen(process.env.PORT);
还要确保asp.net的web.config有节点部分(取自/src/samples/express/web.config ):
<configuration> <system.webServer> <!-- indicates that the hello.js file is a node.js application to be handled by the iisnode module --> <handlers> <add name="iisnode" path="hello.js" verb="*" modules="iisnode" /> </handlers> <!-- use URL rewriting to redirect the entire branch of the URL namespace to hello.js node.js application; for example, the following URLs will all be handled by hello.js: http://localhost/node/express/myapp/foo http://localhost/node/express/myapp/bar --> <rewrite> <rules> <rule name="myapp"> <match url="myapp/*" /> <action type="Rewrite" url="hello.js" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
- 在IIS中发布express js应用程序的步骤
- IIS反向代理到node.js
- iisnode在Windows 7 IIS 7.5投掷500.19错误
- 使用nodeJS与Active Directory进行身份validation
- 将iisnode中的Node.js环境variables(NODE_ENV)设置为Production / Development / Test
- “应用程序已经抛出一个未捕获的exception,并终止:错误:听EACCES 0.0.0.0:80”
- 将TLS / SSL安全POST请求从node.js发送到IIS
- IIS,Node.js和Web应用程序与IISNode没有configuration正确的虚拟目录
- 无法使用繁琐的Azure数据库