In this post, you will see how to install and run Node.js in IIS with IISNode.

Installing Node.js

Firstly, you 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 you have to 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 you install IISNode module, you 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.

Get IIS Ready to Run Node.Js Application

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.

It looks there are some issue with application pool write permission. 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. If you run into a 503 status code with IIS reporting error code 0x5 (ERROR_ACCESS_DENIED), make sure the identity of the application pool running the site that hosts your node.js application has read & execute rights to node.exe on disk. If you are using the default IIS configuration (DefaultAppPool running under ApplicationPoolIdentity), you can set appropriate ACLs on the node.exe by running:

icacls %systemdrive%\node\node.exe /grant IIS_IUSRS:rx

Now you should able to run Node.js sample shipped with IISNode.

IIS 8.0 with Free ASP.NET Hosting
Try our IIS 8.0 with Free ASP.NET Hosting today and your account will be setup soon! You can also take advantage of our Windows & ASP.NET Hosting support with Unlimited Domain, Unlimited Bandwidth, Unlimited Disk Space, etc.