Go to: https://nodejs.org/en/#download
and download Node.js for Windows. For this exercise, we are using v6.9.1 LTS
version.
Place it in C:\node
Download and install the version Windows OS requires (32 or
64 bits). For this exercise, we are using iisnode-full-v0.2.21-x64.msi
Install URL
rewrite module for IIS. Go to: http://www.iis.net/downloads/microsoft/url-rewrite
URL Rewrite
allows Web administrators to easily build powerful rules using rewrite
providers written in .NET, regular expression pattern matching, and wildcard
mapping to examine information in both URLs and other HTTP headers and IIS
server variables. Rules can be written to generate URLs that can be easier for
users to remember, simple for search engines to index, and allow URLs to follow
a consistent and canonical host name format. URL Rewrite further simplifies the
rule creation process with support for content rewriting, rule templates,
rewrite maps, rule validation, and import of existing mod_rewrite rules.
For testing purposes, create a Default site in IIS to test
our Node.js installation. Follow the next steps:
Go to Internet Information Services Manager (IIS). Right
click on Sites and click on Add Web Site…
Add Web Site dialog box will prompt for some input. Fill out
this dialog with:
·
Site Name: Default Web Site
·
Application pool: choose DefaultAppPool
·
Physical path: C:\Program Files\iisnode\www
Make sure to
Test your settings before clicking OK.
To set up
samples, from the administrative command prompt call:
%programfiles%\iisnode\setupsamples.bat (it is recommended to run it as
Administrator)
Or go to: C:\Program
Files\iisnode and run setupsamples.bat from there
The setupsamples.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
At this point
your site should look like:
And if you click on Modules for this Site in IIS7 you should
see iisnode as a native module:
If everything went well, you should
be able to hit: http://localhost/node
Navigate to: http://localhost/node/helloworld/hello.js
and if you are able to see this:
It is because the installation was successful and your
Node.js app is running within IIS on Windows!
Programming thought of the day:
- Michael Sinz: “Programming is like sex, one mistake and you have to support it for the rest of your life.”
No comments:
Post a Comment