iis - what are the things to change when switching from node.js to iisnode? -
i've been trying run node application on iisnode. app runs on node.js smoothly , has no problem. however, need integrate app asp.net application hence i've been trying run app on iis using iisnode! i've been facing difficulties! wondering there need changed in config or server.js file make work ?
thanks !
the required change in node app port number - use process.env.port
value instead of specific numeric in server.js/app.js stated in official /src/samples/express/hello.js (notice last line):
var express = require('express'); var app = express.createserver(); app.get('/node/express/myapp/foo', function (req, res) { res.send('hello foo! [express sample]'); }); app.get('/node/express/myapp/bar', function (req, res) { res.send('hello bar! [express sample]'); }); app.listen(process.env.port);
also make sure asp.net's web.config have sections node (taken /src/samples/express/web.config):
<configuration> <system.webserver> <!-- indicates hello.js file node.js application handled iisnode module --> <handlers> <add name="iisnode" path="hello.js" verb="*" modules="iisnode" /> </handlers> <!-- use url rewriting redirect entire branch of url namespace hello.js node.js application; example, following urls handled 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>
Comments
Post a Comment