Installing and Running node. IIS on Windows - Are you mad? Some folks on our team have been working on making node. Windows. There's a few questions you might have. 267 0 –:–:– –:–:– –:–:– 361 You’re using an outdated location for the get-pip.py. Installing PHP5 with Apache2. Also, Non Thread Safe PHP or Thread Safe PHP. To enable a PECL extension in php.ini all you need to do is remove the semicolon (;) from infront of the PECL extension in question, so to load the curl and exif extensions from above your extension list would look like this.
First, what's node. If you're not familiar with node. 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. The idea is that if you are doing a bunch of Java. Script on the client and you do Java. Script all day, why not do some Java. Script on the server also. One less thing to learn, I suppose. If you are an ASP. NET programmer, you can think of node. IHttp. Handler written in Java. Script. For now, it's pretty low- level. Installing Curl On IiserIt's NOT an Http. Handler, but I'm using an analogy here, OK? Here's a lovely article by Brett Mc. Laughlin that goes into more detail about Node. UPDATE 1: Why does node. Why bother with node at all? There's a number of interesting aspects to node as it sits. It uses a very fast Java. Script 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 Http. Handler in ASP. NET that . However, when I push this HARD with a load testing tool and a thousand virtual clients, I can barely get 6. The request thread is tied up waiting for the . I'm using up ASP. NET pool. It'd be nice if the work would get handled and someone would . 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 2. Async Handlers) with IHttp. Async. Handler 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 IHttp. Async. Handler. Ayende has a simple example Abstract. Async. Handler (there's many of these out there, including a few in our own tools, some things in MVC, and some things in Signal. R (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. Simple. Async. Ayende. Handler : Abstract. Async. Handler. 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 Java. Script callbacks to provide asynchrony in a pleasant way. You use events and callbacks in Java. Script 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, process. Id; filenames = fs. Sync(. Powerful stuff. Why would I want node. Windows and IIS? Tomasz Janczuk is working on the iisnode project lately. You might think that Windows and node don't belong together. What are they thinking? I thought IIS was all about . NET? 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. Tomasz says it best: Some of the advantages of hosting node. IIS using the iisnode module as opposed to self- hosting node. Process management. The iisnode module takes care of lifetime management of node. 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. HTTP traffic between them, therefore enabling full utilization of a server’s CPU capacity without requiring additional infrastructure code from an application developer. The iisnode module ensures that whenever the node. 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. This facility is key in helping you debug node. 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. HTML and Java. Script 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. The iisnode module enables hosting of existing HTTP node. 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. 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. IIS allows the developer to benefit from a range of IIS features, among them: port sharing (hosting multiple HTTP applications over port 8. 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. HTML and Java. Script files, PHP applications, and ASP. NET applications. Sometimes folks freak out when I say you can have an ASP. NET Web. Forms app and a ASP. NET MVC app in the same App. Pool as a . 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. Windows? I'm assuming you are running IIS7. Go download node. Go download a build of iisnode. Unzip iisnode's zip into \inetpub\iisnode. From an Administrator Command Line, run install. The install. bat will: unregister existing ! 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 App. Pool and the File System so I wimped out and gave my local App. Pool . This is awful and totally my fault. I filed an issue on the iisnode Git. Hub and I'll fix it and update this post when I hear back. I made a new App. Pool just for node, gave it SYSTEM access, then assigned the Node Site to this new App. Pool. Your site should look like: And if you click on Modules for this Site in IIS7 you should see iisnode as a native module: At this point, you should be able to hit http: //localhost/node/helloworld/hello. Hello, world! 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 . 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 . 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. 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. H: Cscript wcat. wsf –terminate –update –clients localhost Then I made a folder I called \nodetests and I put these three files in it: wcat. C: \Users\Scott\Desktop\nodetests. It just beats on the four sample applications for a while. 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.)Here's the WCAT tool's console output.. I'm able to consistently do 1. That's a lot of hello worlds. Remember Hanselman's Rule of Scale. 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 IHttp. Handler doing the exact same thing on this same machine gets 2. Here's the node/iisnode results: 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. Server> < handlers> < add name=. 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!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2017
Categories |