I want to deploy Node Js directly to IIS without going through the intermediate step (URL Rewrite).

Tuan Anh Le 20 Reputation points
2024-08-13T06:50:48.15+00:00

I want to deploy Node Js directly to IIS without going through the intermediate step (URL Rewrite). I don't want to run localhost but run directly from IIS. Thanks everyone for your help.

Internet Information Services
0 comments No comments
{count} votes

Accepted answer
  1. Sam Wu-MSFT 7,526 Reputation points Microsoft Vendor
    2024-08-13T10:10:09.8266667+00:00

    @Tuan Anh Le,

    Here’s a step-by-step guide to deploying Node.js directly to IIS without using URL rewriting:

    1. Install IIS

    If IIS is not already installed on your server, you need to install it:

    • Open the Server Manager.
    • Select Add Roles and Features.
    • Choose Web Server (IIS) and complete the installation.

    2. Install iisnode

    iisnode is a module that enables hosting Node.js applications in IIS.

    • Download and install the latest version of iisnode from the official repository: iisnode GitHub Releases.
    • Run the installer to integrate iisnode with your IIS server.

    3. Set Up Your Node.js Application

    1. Prepare Your Application: Ensure your Node.js application has an app.js or server.js file as the main entry point.
    2. Create a Web Application in IIS:
      • Open IIS Manager.
      • Right-click on Sites in the left-hand panel and choose Add Website.
      • Specify the Site name, Physical path (where your Node.js app resides), and a Port or Host name.
      • Make sure to set the Physical path to the directory containing your Node.js application.
    3. Configure the Web.config File: To run your Node.js app without URL rewriting, you need a web.config file in your application directory. This file will instruct IIS to use iisnode to serve your application.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.