{"id":120,"date":"2025-06-27T09:27:55","date_gmt":"2025-06-27T09:27:55","guid":{"rendered":"https:\/\/blog.hostek.com\/?p=120"},"modified":"2025-06-27T09:27:55","modified_gmt":"2025-06-27T09:27:55","slug":"everything-you-need-to-run-node-js-applications-on-windows-iis","status":"publish","type":"post","link":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/everything-you-need-to-run-node-js-applications-on-windows-iis\/","title":{"rendered":"Everything You Need To Run Node.js Applications on Windows IIS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you have an application that\u2019s written in Node.JS but most comfortable with Microsoft Windows you\u2019re in luck. Node.js runs on Windows with minimal effort, you can run an installer, and launch from a console, it\u2019s that easy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But if you want to run a Node.js app with other applications written in .NET or PHP through IIS you\u2019ll need to do a few things. The process is very easy, there\u2019s a small learning curve to getting things running just right.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">During this process I discovered the enjoyment of Node.js and a vibrant community that takes pride in developing really well polished applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting Started With Node.js in IIS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/github.com\/Azure\/iisnode\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">iisnode module<\/a>, from Tomasz Janczuk does all the heavy lifting. In short the module acts as the go between IIS and Node. This enables some really nice functionality that you won\u2019t find by running node from the command prompt exclusively.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A few of these advantages are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can run a Node.js app independently on port 80.<\/li>\n\n\n\n<li>Your Node.js apps can be managed as part of your other websites and apps.<\/li>\n\n\n\n<li>Your letting IIS manage the Node.js process.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">There are more \u201cBenefits\u201d of running node under IIS but I won\u2019t include them because Tomasz has done an excellent job already \u2013 <a href=\"https:\/\/github.com\/tjanczuk\/iisnode\/wiki\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">The Benefits Of iisnode<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What got me curious of the process was this article by Scott Hanselman \u2013 \u201c<a href=\"https:\/\/www.hanselman.com\/blog\/installing-and-running-nodejs-applications-within-iis-on-windows-are-you-mad\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Installing and Running node.js applications within IIS on Windows \u2013 Are you mad?<\/a>\u201d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some of the installation instructions are a bit outdated. The process I\u2019ve outlined in the Hostek wiki \u2013 Installing Node.js on Windows VPS, includes the latest versions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Launching Your First Node.js App On Windows<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Start with the examples provided in the iisnode folder to get a feel for how things work. Copy an example folder, and edit the <em>web. config<\/em> file according to the instructions in the wiki. Once you do this, you should be able to reach your node app in a browser.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You\u2019ll receive output similar to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Hello, world! &#91;helloworld sample; iisnode version is 0.2.2, node version is v0.10.9]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">What you might need to know about Node.js Apps and IIS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There\u2019s supposed to be minimal changes required to run Node.js applications using iisnode. A few of these areas I found many people were confused by and some articles that should help you overcome the common challenges.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Changing the listed address of the HTTP server<\/strong>. Instead of defining the port as a number, you\u2019ll use process.env.PORT environment variable. Scott Hanselman provides a code example and several references about the process.env.PORT environmental variable in the <a href=\"https:\/\/www.hanselman.com\/blog\/installing-and-running-nodejs-applications-within-iis-on-windows-are-you-mad\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">installing and running Node.js article<\/a>.<\/li>\n\n\n\n<li><strong>Rewrite url\u2019s to let the entrypoint process all requests<\/strong>. You\u2019ll want to make sure you have the IIS url rewrite module installed. Then a simple rule that sends all traffic to your entrypoint \u201cserver.js\u201d for example should work perfectly. Here\u2019s a great reference, with code example: http:\/\/tomasz.janczuk.org\/2012\/05\/yaml-configuration-support-in-iisnode.html<\/li>\n\n\n\n<li><strong>Installing npm packages for your app<\/strong>. When you install Node using the .msi, you can use the \u201cnode\u201d ready cmd environment and install any packages you require right from the command line. Navigate to your applications directory and install the necessary npm packages using the standard syntax.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install package<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can easily install Node.js on any of our Windows VPS\u2019s. The example applications were deployed within our platform, using the <a href=\"https:\/\/wcp.hostek.com\/Domain.aspx?DomainId=52688#52688\">our control panel<\/a> to setup a domain. It only takes a few minutes to order a <a href=\"https:\/\/hostek.com\/hosting\/windows\/vps\/windows-vps-hosting\">Reliable Windows VPS<\/a> that you can use for production and development.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have an application that\u2019s written in Node.JS but most comfortable with Microsoft Windows you\u2019re in luck. Node.js runs on Windows with minimal effort, you&hellip;<\/p>\n","protected":false},"author":2,"featured_media":132,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-120","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/posts\/120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=120"}],"version-history":[{"count":0,"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/posts\/120\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/media\/132"}],"wp:attachment":[{"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hassantest-com.server-hassanzahoor-com.vps.ezhostingserver.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}