Hosting Node.js Applications on Windows Server 2012, Complete with Git Deployment and Remote Debugging - Part 2

Hosting Node.js Applications on Windows Server 2012, Complete with Git Deployment and Remote Debugging - Part 2

In the first part of this tutorial we setup a new Windows Azure Virtual Machine and logged into it with Remote Desktop. In part 2 we are going to begin setting up some pre-requisites.

Installing Internet Information Services (IIS)

After logging into your virtual machine for the first time you'll see an application open known as the Server Manager. The first thing we want to do is install IIS because it's not installed by default. To do that click "Add roles and features" in Server Manager.

A wizard will pop open. Simply hit next until you get to the "Server Roles" tab on the left side of the wizard. Then scroll down in the list of roles until you see "Web Server (IIS)" and check the box.

Once you check the box for IIS another window will pop open letting you know that to manage this feature you also need to install the IIS management tools. You don't have to install it if you plan to do all your work remotely using management tools on another machine, but that is outside the scope of this tutorial. For this tutorial I'm going to include the management tools by clicking "Add Features".

Click next to get to the "Features" section of the wizard. I won't lie, I haven't investigated all possible IIS features and I don't what options in the following screenshot are required or optional, but they are the options I've historically selected just to be safe and ensure everything I need is installed. Simply because I know I haven't run into any missing features I recommend ticking the same boxes. If you are more familiar with features of IIS and can explain them then feel free to leave a comment.

Continue clicking next until you get to "Role Services" in the wizard. In the list of role services find and check "Basic Authentication" and "Windows Authentication". Leave everything else the same.

Click next again and you'll see a screen like the following.

There is a warning message at the top that I've highlighted with red. I've seen this message every time and I don't know what is causing it to display, but it has never been a problem so you can disregard it and click install. It will take a few minutes to finish installing. I've never had to restart the VM after this, but if it prompts you to do so when it's done then go ahead. That's all that's needed to install IIS.

Disable IE Enhanced Security Configuration (IEESC)

Before we close Server Manager there is one thing we need to do so you don't pull your hair out for the rest of this tutorial. We need to disable IE Enhanced Security Configuration. This security policy is designed to prevent unauthorized web access on your server. I'm sure that's probably a wonderful feature if you don't actually want to use the internet on your server; using IE with this enabled will make you cry, so let's disable it for now. If you really want to re-enable it afterward then be my guest.

Go to the "Local Server" tab within Server Manager. On the right you'll see a bunch of properties. Next to "IE Enhanced Security Configuration" you should see "On". Click it and then set it to "Off" for Administrators.

Installing Git For Windows

Now that IEESC is disabled we can browse the web without becoming enraged. Open up IE and you'll see that IE really wants you to use recommended security settings. Tell it not to use recommended settings and click OK.

At this point you are welcome to install another browser if you wish. Since the only time I'm really going to use the browser on this machine is during setup I will just stick with IE.

To install Git for Windows simply follow this link to get the latest version of msysgit. Download the executable and run it. Click next on each section of the wizard, accepting all defaults, until you see a screen like this.

By default the first option "Use Git Bash only" is selected. We want Git to be added to our system path so we want the second option, "Run Git from the Windows Command Prompt". If you understand the implications then you are welcome to choose the third option.

Continue clicking next until the wizard finishes and msysgit is installed. That's all you have to do to install Git for Windows.

Installing Node.js

Both Git and Node add to our system PATH variable so the next thing we'll install is Node.js. I've found that modifications to PATH often require a restart before other applications will see them so once Node is finished we will restart our VM for good measure.

To install Node.js go to and click "INSTALL". It's a big green button right in the middle of the page. This will install the correct version for your system. If you've been following my tutorial exactly then your VM is most-likely 64-bit. This is important to remember because both IISNode and Kudu have a really hard time finding the installation for the 64-bit version of Node; I'll show you how to get around that when they come up, just don't be alarmed.

After running the executable simply click next and accept all defaults until the wizard is finished.

Later on you'll see that Kudu gets a little confused with the version of Node.js. To prevent later errors and confusion we need to navigate to the Node installation folder and create a new folder who's name is the same as the version of Node.js you installed. Then we need to copy node.exe into it. As of this writing the current version of Node is 0.10.13. You can find the version on Node's website. My directory now looks like this.

I created a folder called "0.10.13" and I copied the node.exe into it. Make sure to name your folder whatever version of Node you actually installed.

Next we need to get around the 32-bit/64-bit confusion with Node by copying the installation of Node from "C:\Program Files" to "C:\Program Files (x86)". Simply open up windows explorer, navigate to "C:\Program Files" and copy the folder called "nodejs". Now paste the folder into "C:\Program Files (x86)".

That's all that is required to install Node.js and get around some of the issues with the applications we are about to install. I recommend restarting your virtual machine at this point just to make sure modifications to your PATH variable are available to all other applications.

Installing IISNode

The next thing we'll install is IISNode. To do this head over to the Github repository for IISNode and scroll down through the README file until you see "Installing for IIS 7.x/8.x". Select x64 from the provided links.

After you've downloaded the installer simply run it. There are no options to configure so just click install and then finish. That's it for this one.

That's it for part 2. Time to move on to part 3 and install Kudu.