HTTP Error 404.0 - Not Found running Node Express api from virtual application

Roger Hopkins 1 Reputation point

I'm trying to deploy multiple Nodejs + Express API's from subfolders/virtual applications under one App Service.

For those that are wondering why: We have one custom domain for a set of API's. There is one common API that all apps will use and separate API's to/from different service providers.

The url's would be something like,, etc.

I've spent the last several days researching this Q&A, MSDN blogs and Stack Overflow and trying multiple solutions with no success.

Here's what I've tried/accomplished:

  • Created an App Service with a subfolder/virtual application named app1
  • Deployed a simple Node http api (following the Node.js web app quick start) to the wwwroot\app1 subfolder/virtual application called the api from Postman - successful
  • Deployed a simple Node/Express api to the wwwroot folder and called the api from Postman - successful
  • Deployed the same Node/Express api to the wwwroot\app1 sub-folder and called the api from Postman . I first deleted all of the files from wwwroot to make sure there were no overlaps. - Received error 404.

Detailed Error Information:
Module iisnode
Notification ExecuteRequestHandler
Handler iisnode
Error Code 0x00000000
Requested URL https://cpr-node-test:80/common/index.js
Physical Path C:\home\site\wwwroot\common\index.js
Logon Method Anonymous
Logon User Anonymous

Here is my index.js code:
const express = require('express');
const app = express();

const host = process.env.WEBSITE_HOSTNAME
const port = process.env.PORT || 1337;

app.get('/', (req, res) => res.send(App1 host ${host} listening on port ${port}!));
app.listen(port, () => console.log(Example app1 host ${host} llistening on port ${port}!));

Here is my web.config file:

<?xml version="1.0" encoding="utf-8"?>
This configuration file is required if iisnode is used to run node processes behind
IIS or IIS Express. For more information, visit:


<add name="iisnode" path=".js" verb="" modules="iisnode" />

                <!-- Don't interfere with requests for node-inspector debugging -->
                <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">                    
                     <match url="^index.js\/debug[\/]?" />

                <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
                <rule name="StaticContent">
                     <action type="Rewrite" url="public{REQUEST_URI}"/>

                <!-- All other URLs are mapped to the Node.js application entry point -->
                <rule name="DynamicContent">
                          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
                     <action type="Rewrite" url="index.js"/>


      <iisnode watchedFiles="*.js;node_modules\*;routes\*.js;views\*.jade"/>
      <directoryBrowse enabled="true"/>


I'd appreciate any help I can get. Thanks

Internet Information Services
{count} votes

2 answers

Sort by: Most helpful
  1. Roger Hopkins 1 Reputation point

    Thank you. I read these articles before and they require a Windows PC.

    I have a Macbook running OS X. Is there an alternative?

    0 comments No comments

  2. Bruce ( 59,306 Reputation points

    On a macOS you use launchd to start the node projects with different ports. Then use Apache or ngnix to reverse proxy to the node sites. The url rewrite rules are similar. See the docs for the proxy you pick.

    Google for lots of examples

    0 comments No comments