Enable node.js with IIS

Configuring IIS node.js with Windows Server 2012

  1. Before proceeding further we need to install below mentioned application:-

  1. Create a folder into C drive or as per you need.
  2. After creating the folder provide the full write permission to the IIS_ user for managing the folder.

  1. Install Express and  http-server in the myapp directory or the folder which you have created use below mentioned commands in command prompts:-

  1. Now Open IIS server manager right click on the IIS server, click on Add website.

  1. Add new website popup will appear.

  1. Add the application pool for the selected website.

  1. Provide the Site name,  website directory URL, then click on OK to continue.

     

  1. Once the express package is installed in the folder run below sample code for checking weather configuration is done properly or not. save below mentioned code in the name of app.js or as per your choice.

var express = require("express");
    var app = express();
    app.get("/", function(req, res) {
      res.send("Hello Worlxxxxd!");
    });
    // This is REQUIRED for IISNODE to work
    app.listen(process.env.PORT, () => {
      console.log("listening");
    });

  1. Also make sure in webconfig file provide the default page name in below mentioned point in image.

  1. Now access your website on your browser.



Article ID: 1266
Last updated: 26 Jul, 2020
Revision: 4
Windows Hosting -> Windows Server -> Enable node.js with IIS
https://kb.diadem.in/enable-nodejs-with-iis_1266.html