it:ad:node.js:howto:install:and_use_iisnode_to_host_node.js_within_iis

IT:AD:Node.JS:HowTo:Install and use IISNode to host Node.JS within IIS

The first part of the work around (discussed in this thread is to copy the Node.js files to the target dir to fool the installer)

Then have to read here regarding setting nodeProcessCommandLine to point to real direction.

If you get past that, should be able to proceed with setting up samples, from the command prompt (in admin mode) call %programfiles%\iisnode\setupsamples.bat then go check that http://localhost/node exists.

I found the install rather rough. Not exactly sure why it started working …

I tried adding the iisnode element to the config file (as per above tip) but it wouldn't take it. I checked in machine.config and then central web.config but saw no mention of it, but it was listed:

After all that, started working. Maybe because I started to use admin more? Who knows…Except that it did.

More hints as what to do (ie, install the x32 and x64 sdk binaries first): http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx

Update the app's web.config:

<configuration>
  <system.webServer>
    <handlers>
      <add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
    </handlers>    
  </system.webServer>
</configuration>

Or for a whole directory, use location:

<configuration>
  <location path="nodejsapps">
    <system.webServer>
      <handlers>
        <add name="iisnode" path="*.js" verb="*" modules="iisnode" />
      </handlers>   
    </system.webServer>
  </location>
</configuration>

That points to a node.js ready *.js file:

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);  
**Important**:

Y

ou can't define the port – you have to tap into what IIS gives you, hence the “process.env.PORT” in the above code snippet.

  • /home/skysigal/public_html/data/pages/it/ad/node.js/howto/install/and_use_iisnode_to_host_node.js_within_iis.txt
  • Last modified: 2023/11/04 02:25
  • by 127.0.0.1