Scott Hanselman

Installing and Running node.js applications within IIS on Windows - Are you mad?

August 28, '11 Comments [59] Posted in IIS | nodejs | Open Source
Sponsored By

iisnode registering node.js in IIS management Some folks on our team have been working on making node.js work awesomely on Windows. There's a few questions you might have.

First, what's node.js?

If you're not familiar with node.js, it's a new web programming toolkit that everyone's talking about. It's the one that makes you feel not hip if you don't know what it is. Like Ruby on Rails was a few years back. Folks called it "Node" and it's basically server-side JavaScript. The idea is that if you are doing a bunch of JavaScript on the client and you do JavaScript all day, why not do some JavaScript on the server also. One less thing to learn, I suppose.

If you are an ASP.NET programmer, you can think of node.js as being like an IHttpHandler written in JavaScript. For now, it's pretty low-level. It's NOT an HttpHandler, but I'm using an analogy here, OK? Here's a lovely article by Brett McLaughlin that goes into more detail about Node.js and what it is. His subtitle is "Node isn't always the solution, but it does solve some important problems" and that's just exactly it.

UPDATE 1: Why does node.js matter?

Why bother with node at all? There's a number of interesting aspects to node as it sits. It uses a very fast JavaScript engine called V8, but more importantly its I/O is asynchronous and event-driven which contrasts with typical synchronous code.

For example, a naive hello world HttpHandler in ASP.NET that "does some work" for a few seconds (gets a file, accesses a service, etc) could look something like this:

public class SimpleHandler : IHttpHandler 
{
public void ProcessRequest(HttpContext context)
{
Thread.Sleep(2000); //Do something that takes a while
context.Response.Write("Hello from SimpleHandler");
}

public bool IsReusable { get { return true; } }
}

And this is usually fine for most stuff. However, when I push this HARD with a load testing tool and a thousand virtual clients, I can barely get 60 requests a second. The request thread is tied up waiting for the "work" to happen and everyone else gets in line. I'm using up ASP.NET pool. It'd be nice if the work would get handled and someone would "call me back" when it's finished. It's like waiting on hold for tech support. You are effectively blocked as you wait for them to pick up their end. Wouldn't it be nice if they just called you back when they were ready?

ASP.NET has always been able to do things (see this MSDN article from 2003 on Async Handlers) with IHttpAsyncHandler but it's always been a bit hard and almost no one knows about it. With the Async CTP and the Task libraries built into .NET, you can build a nicer abstraction on top of IHttpAsyncHandler. Ayende has a simple example AbstractAsyncHandler (there's many of these out there, including a few in our own tools, some things in MVC, and some things in SignalR (more on that soon)) that we can use to do similar work. This example could also do other more complex and pertinent things like file IO, db IO or calling a web service. This is a naive example that doesn't map exactly to the node one below, but it makes the point. Plus, it's nice to look at.

public class SimpleAsyncAyendeHandler : AbstractAsyncHandler
{
protected override async Task ProcessRequestAsync(HttpContext context)
{
await TaskEx.Delay(2000);
await context.Response.Output.WriteAsync("Hello from Ayende and Scott");
}
}

Pointing the same 1000 virtual clients at this handler gives me 500 requests a second, which makes sense as a request takes 2 seconds to finish. If we were doing I/O or other more complex and long running things than waiting, this scales better than the first example. Doing asynchronous code in .NET as well as parallelism is much easier than before, as evidenced by the two lines of  code above and the simplicity of Ayende's small example. The fact that this kind of thing is easy and elegant in node is an attractive thing about node.

Node loves asynchrony, and uses JavaScript callbacks to provide asynchrony in a pleasant way. You use events and callbacks in JavaScript already on the client, why not use them on the server? Here's an example from Marc Fasel's blog on the topic.

First, some synchronous file work via Marc:

var fs = require('fs'), filenames, i, processId;

filenames = fs.readdirSync(".");
for (i = 0; i < filenames.length; i++) {
console.log(filenames[i]);
}
console.log("Ready.");

processId = process.getuid();

And the same work using an asynchronous pattern that may look familiar!

var fs = require('fs'), processId;

fs.readdir(".", function (err, filenames) {
var i;
for (i = 0; i < filenames.length; i++) {
console.log(filenames[i]);
}
console.log("Ready.");
});

processId = process.getuid();

The I/O happens and the callback function that's dependant on the result is executed when the I/O is finished. Powerful stuff.

Why would I want node.js to run on Windows and IIS?

Tomasz Janczuk is working on the iisnode project lately. You might think that Windows and node don't belong together. "That's just wrong! What are they thinking? I thought IIS was all about .NET?" Well, you may recall I spoke at CodeMash a few years back on IIS7 and PHP and did a screencast showing how IIS7, PHP and FastCGI could push many thousands of requests a second. The IIS folks, the Windows folks, the Azure folks, want to make sure everything runs well on Windows. Remember, we sell Windows, so it's good if it does many things well. ;)

Why bother getting node to run on IIS? Tomasz says it best:

Some of the advantages of hosting node.js applications in IIS using the iisnode module as opposed to self-hosting node.exe processes include:

  • Process management. The iisnode module takes care of lifetime management of node.exe processes making it simple to improve overall reliability. You don’t have to implement infrastructure to start, stop, and monitor the processes.
  • Scalability on multi-core servers. Since node.exe is a single threaded process, it only scales to one CPU core. The iisnode module allows creation of multiple node.exe processes per application and load balances the HTTP traffic between them, therefore enabling full utilization of a server’s CPU capacity without requiring additional infrastructure code from an application developer.
  • Auto-update. The iisnode module ensures that whenever the node.js application is updated (i.e. the script file has changed), the node.exe processes are recycled. Ongoing requests are allowed to gracefully finish execution using the old version of the application, while all new requests are dispatched to the new version of the app.
  • Access to logs over HTTP. The iisnode module provides access the output of the node.exe process (e.g. generated by console.log calls) via HTTP. This facility is key in helping you debug node.js applications deployed to remote servers.
  • Side by side with other content types. The iisnode module integrates with IIS in a way that allows a single web site to contain a variety of content types. For example, a single site can contain a node.js application, static HTML and JavaScript files, PHP applications, and ASP.NET applications. This enables choosing the best tools for the job at hand as well progressive migration of existing applications.
  • Minimal changes to node.js application code. The iisnode module enables hosting of existing HTTP node.js applications with very minimal changes. Typically all that is required is to change the listed address of the HTTP server to one provided by the iisnode module via the process.env.PORT environment variable.
  • Integrated management experience. The issnode module is fully integrated with IIS configuration system and uses the same tools and mechanism as other IIS components for configuration and maintenance.

    In addition to benefits specific to the iisnode module, hosting node.js applications in IIS allows the developer to benefit from a range of IIS features, among them:

    • port sharing (hosting multiple HTTP applications over port 80)
    • security (HTTPS, authentication and authorization)
    • URL rewriting
    • compression
    • caching
    • logging

These are all compelling, but the most interesting bit here, in my opinion, is integration. The iisnode module is a proper IIS module, just like ASP.NET and PHP. This means you can have a single website that has multiple kinds of content. Restated from above:

For example, a single site can contain a node.js application, static HTML and JavaScript files, PHP applications, and ASP.NET applications.

Sometimes folks freak out when I say you can have an ASP.NET WebForms app and a ASP.NET MVC app in the same AppPool as a "hybrid." Frankly, Dear Reader, people don't even realize the power and flexibility of IIS. When you plug in something new like node but run it the way you run other things it inherits all the coolness of the outer container, in this case, IIS.

Fine, you got me, how do I run node.js on Windows?

I'm assuming you are running IIS7.

  • Go download node.exe, and put it in c:\node
  • Go download a build of iisnode.
  • Unzip iisnode's zip into \inetpub\iisnode
    • (that was my idea, not sure if it's the best place)
  • From an Administrator Command Line, run install.bat.

The install.bat will:

  • unregister existing "iisnode" global module from your installation of IIS if such registration exists
  • register iisnode as a native module with your installation of IIS
  • install configuration schema for the "iisnode" module
  • remove existing "iisnode" section from system.webServer section group in applicationHost.config
  • add the "iisnode" section within the system.webServer section group in applicationHost.config
  • delete the iisnode web application if it exists
  • add a new site iisnode to IIS

No warranties! Be careful, you're living on the edge. Remember, you're reading this stuff on some random dude's blog.

WARNING: I couldn't figure out the right permissions for the AppPool and the File System so I wimped out and gave my local AppPool "SYSTEM" permissions. This is awful and totally my fault. I filed an issue on the iisnode GitHub and I'll fix it and update this post when I hear back.

I made a new AppPool just for node, gave it SYSTEM access, then assigned the Node Site to this new AppPool. Your site should look like:

Node Site in IIS7

And if you click on Modules for this Site in IIS7 you should see iisnode as a native module:

Hey, it's iisnode as a native module, just like I said. Crazy.

At this point, you should be able to hit http://localhost/node/helloworld/hello.js and get back:

Hello, world! [helloworld sample]

The contents of which are simply:

var http = require('http');

http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello, world! [helloworld sample]');
}).listen(process.env.PORT);

Lovely.

Fooling around with WCAT (Web Capacity Analysis Tool) and node.

Disclaimer: To be clear, this is so very fooling around. This is just to show that it works and it can do the basics really fast. I'm not doing a benchmark nor am I saying "this works better than this other thing." Remember, they just got started recently porting node itself to Windows, and Tomasz and friends are just beginning their work. So, don't overreach. That said, the preliminary work they are doing is really impressive.

I couldn't help myself. I mean, it's one thing to install a helloworld of some new thing, run it once and go "OK, that runs." It's another to pound it until it says "Uncle." After I got the hello world stuff working, I wanted to do some poor man's stress testing to see what the players involved did.

First, I installed WCAT, a free Web Capacity Analysis Tool from the IIS team.

  1. WCAT 6.3 x86
  2. WCAT 6.3 x64

Warning. This is a command-line only tool and it's really persnickety when you run it. It's confusing and it took me a minute to setup.  Here's the steps I took after installing. This is all from an Administrator Command Prompt. Note also that I'm doing this all on one machine, which is cheesy, but remember, it is a GOM.

  1. cscript //H:Cscript
  2. wcat.wsf –terminate –update –clients localhost
  3. Then I made a folder I called \nodetests and I put these three files in it:

wcat.bat

pushd C:\Users\Scott\Desktop\nodetests
"c:\program files\wcat\wcat.wsf" -terminate -run -clients localhost -f settings.ubr -t nodescenario.ubr -s localhost -singleip -o C:\Users\Scott\Desktop\nodetests
pause

nodescenario.ubr (or call it whatever you want)

This is so basic. It just beats on the four sample applications for a while.

scenario
{
name = "node_fun";

warmup = 30;
duration = 90;
cooldown = 30;

default
{
setheader
{
name = "Connection";
value = "keep-alive";
}
setheader
{
name = "Host";
value = server();
}
version = HTTP11;
statuscode = 200;
close = ka;
}

transaction
{
id = "foo";
weight = 1000;
request
{
url = "/node/logging/hello.js";
}
}
transaction
{
id = "bar";
weight = 2000;
request
{
url = "/node/helloworld/hello.js";
}
}
transaction
{
id = "baz";
weight = 2000;
request
{
url = "/node/defaultdocument/";
}
}
transaction
{
id = "bat";
weight = 2000;
request
{
url = "/node/configuration/hello.js";
}
}
}

settings.ubr

I just copied in the one from samples and uncommented out and changed (and tweaked during testing) these lines:

server         = "hexpower7";
clients = 1;
virtualclients = 8;

Now, run the Test

Next, I ran wcat.bat as an Administrator...you can see all the little node.exe's firing up. I've got a

(Remember they are running as SYSTEM because I was unable to figure out the right permissions. That's my bad, no one else's. I'll figure it out one day.)

Lots of little node processes

Here's the WCAT tool's console output...I'm able to consistently do 10,000 hello worlds a second and ended up with just under a million normal requests and responses in 90 seconds. That's a lot of hello worlds.

Remember Hanselman's Rule of Scale.

"If you do nothing, you can scale infinitely." - Me

Of course, this is all local on a fast machine. This is just hello world (with some logging) so it's not testing node much, nor IIS much, but rather the collaboration between the whole system, IIS, iisnode, and node itself.

Aside: an ASP.NET IHttpHandler doing the exact same thing on this same machine gets 22,500 requests a second, so node and iisnode has some room to improve, which is great.

Here's the node/iisnode results:

Pushing a million transactions in 90 seconds

There's a lot of things I could configure on both sites, number of clients, virtual clients, as well as iisnode-specific settings (which are, nicely enough, managed in a web.config:

<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
</handlers>
<iisnode
nodeProcessCommandLine="%systemdrive%\node\node.exe"
maxProcessCountPerApplication="4"
maxConcurrentRequestsPerProcess="1024"
maxPendingRequestsPerApplication="1024"
maxNamedPipeConnectionRetry="3"
namedPipeConnectionRetryDelay="2000"
asyncCompletionThreadCount="4"
initialRequestBufferSize="4096"
maxRequestBufferSize="65536"
uncFileChangesPollingInterval="5000"
gracefulShutdownTimeout="60000"
loggingEnabled="true"
logDirectoryNameSuffix="logs"
maxLogFileSizeInKB="128"
appendToExistingLog="false"
/>
</system.webServer>
</configuration>

This is pretty cool stuff. I like that the team I work with is excited to make things work well on IIS and I'm stoked that I can mess around with node now without firing up VMs. I'll report back as I learn more!

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. I am a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Sunday, August 28, 2011 9:25:00 AM UTC
Just tried WCAT. It sometimes (I ran the same script multiple times...) omits the summary after "Finished collecting statistics". Meh. How do I fix that? It's a nice tool, much better than Apache bench on Windows.
Jabe
Sunday, August 28, 2011 9:34:59 AM UTC
This is what I have been waiting for. Thank you so much :)
Sunday, August 28, 2011 9:36:56 AM UTC
Jabe - Dunno. Can't you look in it's logs, that's where the report/results will be.
Sunday, August 28, 2011 10:07:17 AM UTC
Pretty Cool! Now we just need a reliable way to connect to mssql.
Mike
Sunday, August 28, 2011 10:57:46 AM UTC
I had been wondering why iisnode existed, and this post explains it. Thanks.

Now, if they could just get npm working...
Sunday, August 28, 2011 11:46:30 AM UTC
Will iisnode accept contributions from outside MS? I know that was a big deal with Nuget, hope we're still moving in the right direction...
Sunday, August 28, 2011 1:03:13 PM UTC
@Scott - I've found a similar question on serverfault here: http://serverfault.com/questions/26062/web-capability-analysis-tool-wcat-no-output-xml

No solution unfortunately. So I just settled with the XML output (which actually works for me unlike the op on serverfault). You just need to get report.xsl from program files and view the report in IE9 compatibility mode because it contains unsafe local content yaddayadda.
Jabe
Sunday, August 28, 2011 2:57:47 PM UTC
Very useful post, thank you Scott :).
Sunday, August 28, 2011 3:17:42 PM UTC
@Mark try ryppi instead of npm, its not as fancy and requires python but gets the job done without having to install cygwin on windows.

https://github.com/japj/ryppi
Sunday, August 28, 2011 11:17:57 PM UTC
Now if only the node package manager (npm) would get its stuff together and run on windows, so we could pull down express/etc and do real work.
Monday, August 29, 2011 1:58:51 AM UTC
Now, I nearly failed math in school, but wouldn't (nothing * infinity) == nothing? ;)
Monday, August 29, 2011 3:22:49 AM UTC
@Keith iisnode is not an ms project.

@Mark Rendle & Ray O'Neill

Don't think npm will be fixed for windows. The 'installer' is a curl command to download a shell script. That is representative of the npm ecosystem.
Monday, August 29, 2011 8:28:06 AM UTC
Anyone get this running on a 64 bit system?

Running Enable 32-Bit applications False setting under application pool -> http://localhost/node works. http://localhost/node/helloworld/helloworld.js -> HTTP Error 503.0 - Service Unavaiable.

Running Enable 32-Bit application True setting under application pool http://localhost/node/ -> get Http Error 503. The service is unavailable.

It's stated in installation that your supposed to turn Enable 32-Bit application setting to true on a 64 bit system. However this made nothing work at all.
Mike
Monday, August 29, 2011 8:53:16 AM UTC
Very cool - I did have a brief look at iisnode and really didn't get time to go into it..

Very good post, really detailed. Good to keep a view of what really can happen. IIS gets the poor web server treatment a lot in my personal experience. I have been eager to really give node a run - not being too great in the nx world, this is excellent (even the part about scaling to multiple processors should be enough for anyone to consider)
Monday, August 29, 2011 9:56:03 AM UTC
I am thinking this would be perfect for web sockets using Socket.IO.

Would it be possible to pass data from Node to an existing C# domain model?
Monday, August 29, 2011 10:00:38 AM UTC
Rooney - via JSON over HTTP, sure!
Scott Hanselman
Monday, August 29, 2011 11:24:36 AM UTC
I love node, I also love Visual Studio.

Although excellent debuggers do exist for node it would be absolutely fantastic if it would be possible to debug the JavaScript running in node from Visual Studio, like it is currently possible to debug JavaScript running in IE.

I would be happy to implement such a debugger. The V8 debugger interface is well document, but I'm not able to find the documentation on how to build the VS part. I asked some people I know at MSFT but nobody seems to know. Can you help me with a pointer in the right direction?

Thank you!
Monday, August 29, 2011 2:30:25 PM UTC
FYI: Here is a (sadly abandoned) MSSQL driver for node.js: https://github.com/orenmazor/node-tds
Monday, August 29, 2011 2:53:26 PM UTC
@Liam: As far as I know, Issac has said NPM will definitely support Windows, but he's waiting until the v0.5.x branch is more stable. I assume NPM will support Windows by the time v0.6 is released.

Ryppi is a great stopgap until then.
Monday, August 29, 2011 8:39:26 PM UTC
@ScottH, thank you for this write-up. Just great to see work on this front, even if it's early work.

I've been playing with Node.JS for several months now and really love its simplicity and the variety of plugins, except for that whole single-process problem.

Looking at the XML config file brought a big grin to my face.

The Nodejitsu team have gone through quite a bit of effort to make similar functionality on the Linux platform via command-line. But having this in IIS, feels a step "grander".
Monday, August 29, 2011 9:00:48 PM UTC
Mike - Weird, I'm running it on my 64bit system but I used the 64 bit build. Node.exe is 32 but though. I'll double check.
Monday, August 29, 2011 10:17:45 PM UTC
Scott -

The Module DLL 'C:\inetpub\iisnode\iisnode.dll' could not be loaded due to a configuration problem. The current configuration only supports loading images built for a x86 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.

This is what happened when I have Enable 32-Bit applications as True (Application Pool Setting). So for sure you want this turned off. Still getting HTTP Error 503.0 on hello.js. Are you running Integrated or Classic pipeline?
Mike
Monday, August 29, 2011 10:24:05 PM UTC
Mike - I'm running integrated pipeline.
Monday, August 29, 2011 10:28:56 PM UTC
I wonder about the role of the App pool here. It should only fire up node.exe, which is a separate process - not a w3wp one (is it?)

I guess that the node.exe process is running within the same privileges as the app pool, but I wonder if there is some way to make them talk through IIS and make node/aspnet interoperability easier. Anyway making them talk over tcp (or even http) on the local machine is very fast. I need to get a little free time to set up a nice working example of that.
Monday, August 29, 2011 11:41:10 PM UTC
Can I ask a dumb question?

Is it at all possible to get this running on iis6, I'm stuck in a corporate environment hell bent on remaining in the early 2000's tech wise. I can't use IIS express so that's out, is there any other way?
Tuesday, August 30, 2011 12:50:05 AM UTC
Scott -

Needed to select LocalSystem account for the Application Pool Identity. Works now. Noted on github.

Thx,

Mike
Mike
Tuesday, August 30, 2011 6:23:12 AM UTC
When you are a c# developer. I'd understand the desire to have a c# implementation of node..

Something like node.cs
No special software needed..

I found something but don't know if it's production ready.

https://github.com/Rduerden/Node.cs
juul
Tuesday, August 30, 2011 8:48:21 AM UTC
@juul

"Node.cs" - are you sure that project is not an April fool's joke?

Tuesday, August 30, 2011 8:32:06 PM UTC
I've set everything up including setting the AppPool to run as LocalSystem and setting the node applicaiton to run in that app pool. When I browse to any of the .js files that should execute I instead get the download box. What am I doing wrong?
Brian
Tuesday, August 30, 2011 8:41:50 PM UTC
Another asynchronous .NET option is the Reactive Extensions:

http://msdn.microsoft.com/en-us/data/gg577609
Jed
Wednesday, August 31, 2011 2:48:40 AM UTC
Scott -

As the Task Manager shows. node is under-utilized during your stress-testing. The bottleneck is IIS & iisnode. I'm not sure the benefits you mentioned outweigh the performance hit you take with the additional layer.

The addition of IIS always seemed a bit anti-node to me. What with the additional processes and threads that come along with it.

Oh well, it was fun testing it.

Mark
Mark Struck
Wednesday, August 31, 2011 2:55:46 AM UTC

Node loves asynchrony, and uses JavaScript callbacks to provide asynchrony in a pleasant way. You use events and callbacks in JavaScript already on the client, why not use them on the server?


I think this is the most important basic difference between Node.js and other popular web servers like Apache or IIS.

Couple this with the fact that it's so light-weight and supports JavaScript, and it's rapidly becoming one of the most exciting things I've come across in years.

I really wonder how it does in terms of security. My guess is you can build some pretty dangerous apps if you're not careful.
Wednesday, August 31, 2011 3:58:29 AM UTC
Brian

Did you put node.exe in C:\node\ ?

ex: C:\node\node.exe

Mike
Wednesday, August 31, 2011 2:15:25 PM UTC
Hi Scott, Thanks for the detailed & brief rundown on what Node is and why to consider using it. I've been wanting to research it, but never had time.
Wednesday, August 31, 2011 3:05:12 PM UTC
Mike,

Yes, I sure did. I can run node from the command line just fine. It's just IIS that doesn't seem to recognize it should use the iisnode module when I browse to the .js file. I also verified that the web.config file has an the correct handler configuration pointing to the iisnode module for the given .js file.
Brian
Wednesday, August 31, 2011 3:06:17 PM UTC
Also, I'm running Win 7 64 bit. I had to install the AMD 64 version of iisnode.
Brian
Wednesday, August 31, 2011 5:35:26 PM UTC
sssh stop talking about this secret :) it is awsome. man I wish MS would sell IIS to run on different platforms :)
Wednesday, August 31, 2011 11:32:12 PM UTC
I'm running into the same issues Mike was having. Any tips would be appreciated:

Error: The Module DLL C:\inetpub\iisnode\iisnode.dll failed to load. The data is the error.

Configuration:

Windows 2008 x64
node.exe v0.5.5
iisnode amd64

Installed node.exe to c:\node\node.exe
Installed iisnode folder to c:\inetpub\iisnode
Ran c:\inetpub\iisnode\install.bat

Created New application pool with Integrated Pipelining, LocalSystem Identity, and Enable32-Bit Applications = False.

Moved node application to New Application pool.

http://localhost/node/helloworld/hello.js results in 503.
Thursday, September 01, 2011 12:47:51 AM UTC
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
Thursday, September 01, 2011 5:46:02 AM UTC
Randy - you might be seeing the same issue I was. I had to install the VS 2010 x64 redist binaries:

http://www.microsoft.com/download/en/confirmation.aspx?id=14632

If this doesn't work, check your Event Viewer logs for clues.
Thursday, September 01, 2011 5:37:19 PM UTC
Thanks guys.

I solved the issue by installing the VS2010 x64 redist binaries that David Linked.

I also needed to set Enable 32-Bit Applications back to False on the App Pool.

Enabled 32-Bit Applications on the App Pool needs to be set to False or you'll get Error code:
0xC1 (%1 is not a valid Win32 application)

If VS2k10 Redist isn't installed, you get the Error code:
0x7e (The specified module could not be found)

Works now. Thanks!
Saturday, September 03, 2011 5:55:00 AM UTC
This is really cool. I've been running a vm to do my NodeJs development but this will really help out.

I had problems with the IISNode install for AMD 64 bit. I ended up renaming the 32bit version of the IISNode.dll, copied it into the same folder as the 64 bit file and changed the file that the module was using (couldn't delete the original IISNode.dll). Now it works. I couldn't install the 32 bit because the installer indicated that the install wasn't for my version of windows. I guess I could of edited the install bat.
Saturday, September 03, 2011 12:31:07 PM UTC
Thank you Scott for this introduction to node.js and sharing your first steps using iisnode. As you write "Node isn't always the solution, but it does solve some important problems". It's good to have this choice on the Windows platform. What's coming next: package management with "npm" or VS.NET-integration? I'm curious about it.
Monday, September 05, 2011 1:36:07 AM UTC
I was hoping to see CoffeeScript working with iisnode, but as I haven't seen anyone even mention a CoffeeScript-on-iisnode implementation it seems it's going to need its own implementation on top of it. CoffeeScript has a Javascript-based compiler so CoffeeScript will run anywhere, but real CoffeeScript development involves working with .coffee files and a runtime that knows to automatically pre-load the CoffeeScript compiler and load these .coffee files straight in. Doable, perhaps even easily doable, but I doubt it's doable without directly manipulating the iisnode codebase itself to support pre-loaders and compilers to be declared in the web.config'uration. Does anyone know otherwise?
Monday, September 05, 2011 4:21:05 AM UTC
Gorgeous!
I will be keeping my focus on nodejs
Saturday, September 17, 2011 9:08:54 AM UTC
Scott, regarding your comment on the SYSTEM permissions, why don't you use process monitor to determine exactly what username is being used, which folders and grant accordingly. I realize the common developer would say, who needs permissions. :) I'm from the admin side and try to practice only granting what you need. I realize a development environment is one thing and production is another, I see too many posts where someone is a developer first and then expected to know just enough to setup a server. That might be an over-generalization. :) Anywho, thanks for the good article, I have a better understanding now.
Friday, October 14, 2011 4:04:12 PM UTC
hi, I can use async+await as a standard .NET way and have the same results like you've got with node?
Wednesday, December 14, 2011 4:00:13 PM UTC
Thanks for the blog.
I've got a small update on the WCAT setting up tho(might just be an one off to me since I'm running iis 7.5):
instead of
cscript //H:Cscript
wcat.wsf –terminate –update –clients localhost
I have to change it to
cscript //H:Cscript
wcat.wsf –terminate –clients localhost –update
Otherwise it's giving an error complaining about an argument is missing to do witn -run or -update etc.
Saturday, January 07, 2012 10:25:32 PM UTC
iisnode - Installed it. Installer put it in c:\Program Files\iisnode, not inetpub. Also, there is no install.bat. There's a setupsamples.bat, which I ran. There's also an etw.bat. Not sure what that's for.

Some of the samples ran, but the urlrewrite and express didn't work, both giving HTTP Error 500.19. It's saying web.config isn't valid.

And BTW, I really hate the IIS 7 Manager. The interface is just awful. One of the attractions of node.js was the simplicity of running it from the command line, but now I get sucked into this kind of stuff, as per usual.
Saturday, January 21, 2012 3:52:29 PM UTC
Hi scott is there any possibility that node.js will take over ASP.NET and WCF?
Amit
Monday, January 23, 2012 7:19:39 AM UTC
What I'm not getting is how is this an improvement over JScript? ASP classic has provision for javascript in the form of JScript and there is also JScript.NET. Both of these give you access to ADO for MSSQL. As far as ASP classic goes, as long as your webserver has a recent version of IE installed you also have access to everything in IE's client-side javascript including regular expressions as in:
myStr = myStr.replace(/^\s+/, ""); // Get rid of leading spaces

For ASP Classic, use this as your first line of code and you are good to go:
<script language="javascript" runat="server">

You automatically have access to the common objects of ASP including Request, Response and Session just be sure to capitalize the first letter of each of those.
Monday, February 06, 2012 3:02:22 PM UTC
My worry is that if you have THAT much of permission on your server which seems like you can change a lot on local IIS. Then why do you need the *.js from your localhost. You are the master of machine then run localhost:8888 as separate node server.

I would appreciate if we could have done some magic from Application_start event to run this in embeded mode with MVC3 and open a separate node js server some-where. I don't know where but should that work with any full trust hosting without any IIS modification. Do you hit any idea of what I uttered?
Monday, February 06, 2012 9:14:56 PM UTC
Asif - If you're using MVC3, why use node? Just use SignalR.
Monday, February 06, 2012 9:26:51 PM UTC
I want to use pure node for the following reasons:

1. npm, it reminds me of jquery extensions or Nuget

2. Connect and Express

3. jquery package since you still can create markup like $(...).attr(...).appendTo() or I am sure by $(...).tmpl(data).appendTo

4.Javascript language support rather than PHP/C#/Ruby which are for me mere data middle man this time


The only thing which I will miss BCL :( .NET BCL and all what work was done by Microsoft with linq, generics, dynamic, lambda i will always and always miss that in node.
Monday, February 06, 2012 9:34:51 PM UTC
By the way I prefer using no-sql which are mostly rest based, i also open rest api from mvc3 controller and mostly DO NOT use razor view engine. Just blank views. So most of my view stuff is done in Scalable JS apps patterns by my own or addy osmami's flavor. Every thing on browser. So by saying C# as data middleman I meant it word by word practically. So if you can connect to db like Open Data Protocol by urls then who cares php/C# and ruby. The best thing in MVC3 is it really wrapped up all EXTRA HARDWORK done in asp.net and put us on PURE and STANDARD WED i.e pure html, js and css. And good thing is that Razor was even closer but i Honestly in all my life NEVER did @Html....() and BeingForm() so it was easy to get out of all server side rendering.
Wednesday, February 08, 2012 2:45:19 AM UTC
Sorry Scott If I hurt your feelings :) Possibly MVC3 was nice choice how the hell it is difficult to render static files nd open straight download ports from node.js I am very thankful to Microsoft for getting us IIS7 and MVC3 :) You were correct node could have been used from IIS module rather than completely relying on whole new immature platform. and yes i never meant to ARGUATE
Friday, April 06, 2012 1:51:32 AM UTC
iisnode and socket.io, 404 Not Found? help...
Luiz Carlos
Thursday, November 08, 2012 6:44:17 AM UTC
Great article! But installing on windows is even more easier now. You just nee to run 2 installer file and you're done! We are running node.js on smarterasp.net web hosting server.
Friday, December 14, 2012 3:12:24 AM UTC
I have this error: Can you help me?

iisnode was unable to read the configuration file. Make sure the web.config file syntax is correct. In particular, verify the iisnode configuration section matches the expected schema. The schema of the iisnode section that your version of iisnode requires is stored in the %systemroot%\system32\inetsrv\config\schema\iisnode_schema.xml file.
Fabio Roldan
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.