Azure Websites + node.js - Cannot GET /


When deploying a node.js / express app to Azure Websites I am getting "Cannot GET /" error in the browser. The same application runs flawlessly on the local machine.

web.config is standard (I only removed the Static Rewrite rule), so:

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

Code is deployed in src/server/ (node functions) and src/client/ (static content) folders.

As per the FREB logs the src/server/apps.js is fetched, but in the end the following error is thrown:

ErrorCode   The system cannot find the file specified.     (0x80070002)

Inside app.js I have the following configuration for static files:

asked on Stack Overflow Feb 2, 2017 by Lech Migdal

1 Answer


Azure Websites runs node from the folder where the file defined in the package json as the start file is located, so e.g. for the following:

"start": "node src/server/app.js"

fact it will run node app.js from the src/server folder (you can find there also the iisnode.yml file). Which results in all relative paths getting messed up. One solution for this is to use absolute paths, so e.g.:


and switching between paths using e.g. process.env.NODE_ENV variable.

answered on Stack Overflow Feb 2, 2017 by Lech Migdal

User contributions licensed under CC BY-SA 3.0