@Blog.Author(Nandip Makwana) .LearningExperience(ASP.NET, ASP.NET MVC, IIS, jQuery & Technology Surrounding it...)

January 11, 2012 comment , ,

Installing and Running node.js application with iisnode

Over a last few days, all are talking about asynchronous programming especially node.js and signalr. Microsoft also included AsyncCTP within ASP.NET 4.5. But it seems node.js and SignalR is winning the race. Anyway we are not going to compare AsyncCTP with node.js or SignalR. In this post we will see how to install and run node.js in IIS 7 with iisnode.

Get IIS ready to run node.Js application

To run node.js application under IIS, we need to install node.js engine on server which can be download from http://www.nodejs.org/#download. Installing node.js engine will enable us to run node.js application on windows server. But still we require configuring IIS so it can route .js requests to the node.js engine. This can be easily done with the help of iisnode module for IIS 7.x. Once we install iisnode module, we can configure web.config file to route .js or particular file to iisnode module. Iisnode module can be downloaded from https://github.com/tjanczuk/iisnode/archives/master once you install iisnode, you will able to find iisnode module in IIS Manager under modules.

Iisnode will also install sample application to get started with node.js. Sample application is copied within iisnode installation directory. If you installed iisnode with default settings, then sample can be found in C:\Program Files\iisnode\www directory. To run this sample application, create new application within default website for e.g. let say nodejsapp which points to sample application directory mentioned above. Now go to http://localhost/nodejsapp/ and you should able to see different sample link on your browser.

Now let examine HelloWorld sample. Go to http://localhost/nodejsapp/helloworld/hello.js to run server side JavaScript with the help of node.js engine.

Ohhh!! It looks there are some issue with application pool write permission. Scott Hanselman already posted issue here. There are two temporary workaround to deal with this permission issue. One is disable logging by adding following key in web.config.

Another one is create one application pool with identity as LocalSystem and assign that application pool to the nodejsapp application.

Now you should able to run node.js sample shipped with iisnode.

comments powered by Disqus

Featured Content

Resources & Tools

About Nandip Makwana

Nandip Makwana is passionate about digital world and web. He completed his Masters in Computer Application in June 2011. Currently he is working as a Software Engineer. He has shown great promise and command over ASP.NET and technologies surrounding it during his academic years and professorial life...continue reading