On Windows Azure Pack and IIS, node.js is handled by the iisnode module.  To run a node.js script, a handler mapping will first have to be added to the site's web.config to process the .js script, or all .js scripts, using the iisnode module.
 
 
Handler Mapping
 
To have all .js scripts handled by the iisnode module, add module "iisnode" to the handlers element of the web.config as in the syntax example below:
 
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<system.webServer>
		<handlers>
			<add name="iisnode" path="*.js" verb="*" modules="iisnode" />
		</handlers>
	</system.webServer>
</configuration>
 
If there are other files using the .js extension in the application, necessitating targeting specific files, update the handler path.  For example, if the below ztest.js file were in the document root, the syntax would be:
 
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<system.webServer>
		<handlers>
			<add name="ztest" path="ztest.js" verb="*" modules="iisnode" />
		</handlers>
	</system.webServer>
</configuration>
 
Note when adding a handler for more than one file, each will require a unique name.
 
 
Testing node.js
 
To test node.js, the syntax below may be copied, making sure to use the file extension .js.  Or download and extract ztest.js; then upload the file to the site and visit the page in a browser.
 
	var http = require('http');

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