Installing IISNode 0.2.2 on Windows 2012

There are a number of articles written on IISNode, but I didn’t really find an up-to-date article that describes how to install the latest version on a clean Windows 2012 using the setup packages provided by IISNode, so I’m just writing down the experience to save another developer’s time, because it wasn’t “all out of the box”.

First of all the basics:
  • We use a Windows Server 2012 installation, 64 bit (of course), simple standard version (it is a test setup from my side)
  • Make sure IIS is installed on this system, so that you have working web server… after all it’s called IISNode so there is the requirement for an IIS
  • Make sure NodeJS is installed on your server. IISNode does not install node itself, it is only the glue between NodeJS and IIS (and that is a good thing!). It however does not check whether NodeJS is installed, compared to IIS where the requirement is checked.

ORDER IS IMPORTANT! I accidentally didn’t install all these prerequisites upfront (which is just a nice way of saying I forgot a part), and had a hard time to get IISNode working on the system. Also a read a bunch of articles on problems when only using x64 packages of NodeJS, so installed both x86 and x64 packages of NodeJS on my machine. Don’t know whether that is still a requirement, but it was at one point.

Installing IISNode

Installation of IISNode is getting a matter of downloading the package from the github repo. I used the iisnode-full-iis7-v0.2.2-x64.msi package, which was the most up-to-date at the time of writing. I just ran default installation, and this creates an installation directory in C:\program files\iisnode (I expected it to be in the Inetpub folder to be honest).

After installation go to the installation directory and run setupsamles.bat AS AN ADMINISTRATOR!

Running hello.js

Just as with any other technology, our first goal is getting the “Hello World!” running, which is a matter of getting hello.js to work. The hello.js is located in C:\Program Files\iisnode\www\helloworld. If you did everything correct up until now, you should be able to browse to http://localhost/node/index.htm that contains a link to helloworld example, which will show the readme file on the sample. Launch hello.js from there and you should see this:


Important: if you want to play with the installed samples in the directory they are installed, you will, with default permissions, not be able to change the files since you have no permissions to save files in the Program Files directory! Easiest way out is to change the security permissions on the www folder of the iisnode installation directory !

Running express applications

The samples directory contains a number of sample projects, amongst them one with Express framework, so if you need this, make sure to check those out because there a couple of specific items to be added to the web.config file regarding the URL rewrite module. On the topic, there is perfectly fine article here which makes it useless that I write about it. Important thing to achieve this, is the fact that this configuration is done in IIS web.config file, which is unknown to the node project itself and does not require any changes to your legacy code… which brings me to the next topic.

Transferring legacy NodeJS http server applications to iisnode

IISNode requires little or no changes to your application. The most obvious one is the location where you set the port number for your server to listen. Since this is determined by IIS, this will be passed as an environment variable to your application:

    http.createServer(function (req, res) {

Second part most of us have in custom applications is some additional npm packages, e.g. I use Winston to do some logging output. Luckily, this doesn’t really change with IISNode: just run npm install –save command to add your package and all will be just fine…. so that is a relief and makes life easy and makes sure I do not have to alter my code too much.

Important: if you create your own applications in another location, make sure that NodeJS has proper access rights to the folder, else execution will fail since NodeJS process launched via IIS runs in lower priveleges than your own account. The error does not really mention this is the problem, but in the description there is a small remark on that a log file was not written, which made me come to this conclusion. 

Dual run

Taking the above into account, these changes are that limited, that when you make sure to add a little line of code in your application (var http_port = process.env.PORT || config.http_port), you can still run the application from the command line using the node.exe executable as before, and that is a really good thing. It allows you to run the same code on servers where IIS is not an option, which is a enormous advantage!


Why I like a NodeJS web application on Azure using SQL as a backend

I’ve been doing a lot of studying lately on which technology is best for my new project, and with the abundance of frameworks life doesn’t get any easier. I have a number of requirements which most of us have when creating a new web applications:

– A framework that is easy to use and well supported (in terms of modules, libraries, … whatever makes us not invent the wheel twice)
– Must run in the cloud
– Must run for free in the cloud while I’m developing the thing. I only want to pay as soon as people pay me
– Must be able to develop code easy on any machine

After all my research, I think I found my ideal combination: it is a NodeJS application that delivers a REST API and accompanying AngularJS client pages in combination with SQL on the backend. A number of people reading this will put question marks with this choice of technology, but, there is a good reason why this combination makes sense.

Why NodeJS?

I like NodeJS for two reasons, which are not accidentally on my requirements list:

– It’s javascript, and doesn’t require a compile step while developing. Hence, it is easy to develop NodeJS applications on any system. Macbook, not a problem. Pc at home, with windows 8.1. No problem. Editors in abundance, see my previous article on Visual Studio Code fore example, but for Windows there is also Visual Studio Community edition, one of the better Javascript editors available today.
– There is an extensive list of free modules available via NPM, and up until today, I haven’t found one problem I couldn’t tackle with a module that is freely available. Is seems me from reinventing the wheel, just make up the glue to deliver a nice service

Note: I like C# code as well, don’t get me wrong, and I’ve written web applications in MVC as well. I just like the fact that NodeJS has no compiler requirement, which makes it very easy to develop.

Why Azure?

Most of the people I meet associate Azure development with ASP.NET websites (with our without MVC). That is one option, but NodeJS applications are equally good supported, and, web applications are for free on Azure! You can say about MS what you want, but Azure is a nice piece of work, and the fact you can easily run NodeJS applications on a free of charge web tier is fantastic. Deployment via Git is included and super easy, so what else do you need? I think most people don’t know these options, and often turn to Amazon and OpenShift for these kind of things, as they are more commonly associated with NodeJS.

Though not really applicable for a simple website, but, there is also an Azure module for NodeJS available to manage your Azure objects, so don’t underestimate what NodeJS and Azure have to offer.

Why SQL?

If you see NodeJS, you always see MongoDB or another NoSQL backend. I like MongoDB and NoSQL for what they are made, but, my data is simple and relational, so why should I go for a NoSQL DB? It would just end up in objects referring to each other like a relational schema, I would use Mongoose to enforce all the constraints…. so at the end of the day, SQL does the job here better than NoSQL. I don’t believe following a trend or hype is a good thing if it just for the sake of the trend. If you can get profit out of it, do it, else, stick to what you have and works.

NodeJS has no issue with SQL, for those who are in doubt. There is a great library called Sequelize (check npm repository) that makes it really easy to work with traditional SQL databases.

A limited MySQL DB is also available for free on Azure, so that’s good for kicking off my development. When the app grows, it might not be sufficient anymore, but the customers should pay for the growing storage cost, so no worries about that.

Note: it thought it was possible to get a limited free MS SQL instance for development, but, this seems not to be available anymore. However, the Sequelize component should hide most of the backend for us thus this should be doable.

Note: it is possible to get a MongoDB instance as well on Azure, thought I’m not sure whether that is for free to start with (up until a number of MB’s). If you would need a MongoDB in the cloud, you can always turn to MongoLabs for a free MongoDB instance in the cloud (to start with). I takes only 5 minutes to register and have it working.


For these reasons, this combination is my ideal environment. It might be yours as well for the same or even slightly other reasons. It’s not a trendy combination, but I believe it is a solid one, and that is what counts at the end of the day.

Intellectual masturbation in software development

This week I attended the Techorama developer event in Belgium, with an opening keynote of Hadi Hariri titled “chasing the silver bullet”. To summarize the keynote: “new” technologies arrive every day, and marketing tries to convince us (developers) we always have to use the latest and shiniest new tools available on the market. This is not true, and people with some years of experience in the development community know this: you should only use the latest and new tools when it adds value to whatever your business is, not for the sake of using new things.

This made the keynote relevant to me in two ways:
First of all, those events are always filled with “young ones”; developers with zero to five year experience who actually think they are going to change the world. They won’t, maybe one, if lucky. I was one of those young ones ten years ago, and when I attended these kind of events, I equally felt the urge to go back to the office and introduce all these nice new things. It is easy to get brainwashed when you are young. And there is the exposition room filled with sponsors that all claim to use and play with these latest things, so you kind of feel alien if you would think different. Of course, those companies are in general in the IT consulting business, so they only profit by introducing new technologies and sell additional services to use it, and if you are part of such a company, you might be able to actually always use the latest releases. To ISV companies who develop products, using the latest is only relevant if it adds value to your product, because it will come back and bite you.
Second thought. The word that came immediately in my mind, was the term intellectual masturbationMr. Hariri did not use it during his talk, but it would have perfectly fitted the topic at hand: Intellectual masturbation simply means the engineer does something because it is a challenge for his brain to apply a new technology, and he will get satisfaction from it, but does not take into account whether this adds any value to the product or company that is actually paying him. Where I work, a company creating software  for almost twenty years, we use this term every time an engineer comes up with a shiny new technology that will solve all our issues, or is just fun to use and gets some attention. Funny enough, the sales guys also want us to use these new tools and technologies, because it is nice to bring them up during sales conversations: “yes we have agile development”, “yes we do devops”, “of course we use continuous integration on Github”, “sure we use C# 5.0”. The fact they do not understand it is irrelevant since their job is selling our product and how they make the deal is not that important (so I don’t blame them), even if it involves showing off with “their” developers that use the latest technology on the market.

Just as Mr. Hariri speech, there is no real point to make in this article so far, but only a take away: if you are applying these new technologies, are you doing it for your own excitement, or, are you actually providing value to the business. You’ll see in this blog I work with a lot of new silver bullets, for example the article on Redis and Docker and NodeJS. It is not my intention to convince you of these technologies and apply them straight away. I write these articles while investigating these new technologies so I can see whether they can add value to my business. I’m only writing it down because maybe some day, somebody, somewhere in the world, saves a little time with it to decide whether or not it adds value to his business as well. And even though I did test Redis on Docker on Windows, I’m quite sure I will not use it in our product,  but that doesn’t mean you can’t either, or I will not use it later on in another project when it would be appropriate.

Because just as much as it is your obligation to avoid intellectual masturbation, it is your obligation as a (software) engineer to  be on the lookout for new technologies that can bring in more value to the company. You must remain up-to-date and learn new technologies. So go out and investigate the latest tool, but evaluate it correctly and you have a good career coming, else you are just wasting money.

Running Redis on Docker on Windows

When it comes down to OS’es, I’m not the monogamous kind of guy. I like things that work on Windows, Linux, and Mac, preferably without a lot of troubles (actually, preferably without any troubles, but, I’m a realistic type of guy as well). As such, I was interested to see the power of Redis, but dissapointed it doesn’t really run “out of the box” on Windows. Ok, there is a port avialable, but that’s not always the real thing. So I decided to kill two birds with one stone, and bring in another technology that is still on my bucket list: Docker.

Docker is a software container technology and has some nice advantages for both developers and IT admins, and after 15 minutes it turns out to run real smooth on my Windows machine as well. More information can be found on the Docker site installation documentation. Another nice and very to the point intro can be found here. Note that running Docker on Windows really involves quite some technology, but the installer really hides that nicely. Once docker is running, make sure you know the IP address of the VM host it is running on so you can connect later. It is logged in the console, but will not be visible anymore after running the redis command.

Phase 1 completed, and for those who like open source technology combined with really fast, no nonsense installation and the usual struggles, I really advise Docker and their public repositories. Installing Redis on Docker is a single line command:

docker run -p 6379:6379 redis

If all goes as planned, after the download, your Docker window should look like the below image.

Truth to be told, I did have some issues during installation, where it had an unexpected EOF and the untar command failed. This seem to be common and according to different sources is caused by the “network” and more specifically the “Wifi”. I don’t know the details, but disabling Wifi and continue on the wire solved the issue.


And that is actually all! Redis is running on your machine, ready to use, which means in my case to be used from within NodeJS. Tons of information are available on how to do this, so I will simply show my sample test code I quickly wrote in the Visual Studio Code editor, and this for four reasons:

  • I’m fond of the editor, which I expressed in my previous post
  • You can really easily debug your server side code
  • I really like intellisense that can be added via, it is available for most common node modules and thus also for redis package, and can be simply added by adding the references on top of the file
  • Be warned when connecting to the Redis server. First of all, because this is actually running in a VM with a virtual network on your machine, and thus you need to connect using an IP address as the default localhost will not work. Second, you will use hostname/IP address and port combination, and Redis client takes the port number first. It could be me, but in all languages where I connected to a server, host name is first and then port number comes second. Of course the documentation is correct, but it was that trivial for me that it took me a while to notice and I spend to much time wondering why I was always getting these connecting errors.


And here it is, a full functioning system with Redis running in Docker on Windows and connecting via NodeJS app written in VSCode.



Visual Studio Code for writing and debugging NodeJS applications

I’ve always been a fan of Visual Studio. I started using it when it was still version 6 (when my professional life started) and the only reasonable language was C++. Even though I worked on many different platforms in the meantime, none of the tools I encountered ever came close to Visual Studio. You can hate MS as much as you want (which I do not) but you have got to love their development environment.

Last couple of months I really got into the NodeJS world, which I think is a really great environment: you can develop on any platform, and it runs on all of the platforms, cloud or on premise, everybody supports it. You cannot get any “vendor lock-in”, which is great and you have all options open. You want to move to Azure? Fine, no problem. Amazon. Equally ok. Run locally on your Macbook. Done. An extra advantage is the simple type and run principle (which is a well known principle I just invented), which means there is no compilation or building required before running the application.

If you read this intro, you will understand that I was very pleased with the announcement of Visual Studio Code, which fits perfectly in my scheme of things. Of course there is Sublime which everybody is using for this kind of task (just as me), and truth to be told, some of the VSCode features are simply copies, but it works equally good for me, and has suprised me. Biggest reason why it pleases me: it’s simple. As powerfull as Sublime is, I only used 2% of it’s features for developing node applications, so it was too much. VSCode is simple, offering everything I needed, and even more, using the docs on I was able to create a “blanco nodejs template application” and configure debugging in under 5 minutes. Combine this with the great support for client side javascript debugging we have today in allmost all browsers, and you have full support for debugging on client and server!

vscode debugging


Another great feature is the support for type definitions in combination with the intellisense. All info is in the docs, just mentioning it here because it actually really works, even tough I’m not the biggest fan of Typescript (I don’t like any “extra” steps for converting or compiling things… remember the type and run principle), I don’t even use it my apps. It just great to have intellisense support for the basics of a language.


Next job is to experiment with the task features VSCode offers, which also seems to solve some issues for me… but I need a little more time for that one.

Two remarks to close this article:

– It could well be that Sublime is equally capable of doing all of this, I don’t know. And that is exactly my point. In all the power of Sublime I couldn’t easily find these things, while with VSCode I got things running in no time with a very to the point document

– There are still some improvements to be done on VSCode, especially the part on HTML tags feels sometimes wrong. For example, in any modern HTML editor typing <br> will convert your tag to <br />, while VSCode will just complete the tag, so you end up with <br></br> which of course nobody wants. Same goes for a lot of other tags. Also starting a closing tag does not automatically bring up intellisense to suggest the rest of the tag. These features are available in Visual Studio 201x, so they know how to do it…

Better late than never…

About a year or ten too late I will finally start a blog for my “professional” activities. For my personal life I have a great wife and children documenting everything in great detail, so there is no need for even more info.

I thought about this a long time, but never really found the right reason to do it, even though I really think Scott Hanselman is right in his article that you must read: and the best one that lead to

So anyway, here we go… hope somebody find something usefull on it and is inspired by it.