Node.js app in Azure subfolder not running
<p>We've tried everything with a colleague of mine, but we couldn't get it working :(
We have a Web App in Azure - an MVC one. Inside of it we want to add a blog as a subfolder, but for now we test with a very simple express app.</p>

<p>Basically, we have the main MVC app. 
I've tried both moving my small test node.js app to site\test and site\wwwroot\test.
There is a virtual application /test pointing to site/test. (from the Azure portal Application Settings).</p>

<p>Inside the test folder, web.config:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;configuration&gt;
    &lt;system.webServer&gt;
        &lt;handlers&gt;
            &lt;add name="iisnode" path="index.js" verb="*" modules="iisnode" /&gt;
        &lt;/handlers&gt;
        &lt;rewrite&gt;
            &lt;rules&gt;
                &lt;rule name="DynamicContent"&gt;
                    &lt;action type="Rewrite" url="index.js" /&gt;
                &lt;/rule&gt;
            &lt;/rules&gt;
        &lt;/rewrite&gt;
    &lt;/system.webServer&gt;
&lt;/configuration&gt;
</code></pre>

<p>index.js</p>

<pre><code>var express = require('express');
var app = express();

console.log(1);

app.get('/', function (req, res) {
  res.send('Hello World!');
});

app.listen(process.env.PORT || 3000, function () {
  console.log('Test is live');
});
</code></pre>

<p>package.json</p>

<pre><code>{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.14.0"
  }
}
</code></pre>

<p>After I try to open <a href="http://MySite.azurewebsites.net/test/" rel="nofollow">http://MySite.azurewebsites.net/test/</a> and then open the main site from FTP and go to LogFiles/DetailedErrors, there are two errors:</p>

<pre><code>HTTP Error 500.1000 - Internal Server Error
Detailed Error Information:
Module     iisnode
Notification       ExecuteRequestHandler
Handler    iisnode
Error Code     0x8007000d
Requested URL      http://MySite:80/test/index.js
Physical Path      D:\home\site\wwwroot\test\index.js
Logon Method       Anonymous
Logon User     Anonymous
</code></pre>

<p>and</p>

<pre><code>HTTP Error 403.14 - Forbidden
Detailed Error Information:
Module     DirectoryListingModule
Notification       ExecuteRequestHandler
Handler    StaticFile
Error Code     0x00000000
Requested URL      http://MySite:80/test/
Physical Path      D:\home\site\wwwroot\test\
Logon Method       Anonymous
Logon User     Anonymous
</code></pre>

<p>Finally, here's the main app web.config. I suspect it might hold the key to the problem:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;configuration&gt;  
  &lt;configSections&gt;    
    &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
    &lt;sectionGroup name="jsEngineSwitcher"&gt;
      &lt;section name="core" type="JavaScriptEngineSwitcher.Core.Configuration.CoreConfiguration, JavaScriptEngineSwitcher.Core" /&gt;
      &lt;section name="msie" type="JavaScriptEngineSwitcher.Msie.Configuration.MsieConfiguration, JavaScriptEngineSwitcher.Msie" /&gt;
      &lt;section name="v8" type="JavaScriptEngineSwitcher.V8.Configuration.V8Configuration, JavaScriptEngineSwitcher.V8" /&gt;
    &lt;/sectionGroup&gt;
  &lt;/configSections&gt;  
  &lt;connectionStrings&gt;
    some conn strings
  &lt;/connectionStrings&gt;    
  &lt;location path="." inheritInChildApplications="false"&gt;
    &lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="ClientValidationEnabled" value="true" /&gt;
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;      
      &lt;add key="webpages:Enabled" value="true" /&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
    &lt;/appSettings&gt;
  &lt;/location&gt;
  &lt;location path="." inheritInChildApplications="false"&gt;
    &lt;system.web&gt;      
      &lt;authentication mode="None" /&gt;
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5" /&gt;
      &lt;httpHandlers&gt;
        &lt;add path="*.png" verb="*" type="System.Web.StaticFileHandler" validate="true" /&gt;
        &lt;add path="*.js" verb="*" type="System.Web.StaticFileHandler" validate="true" /&gt;        
      &lt;/httpHandlers&gt;      
    &lt;/system.web&gt;
  &lt;/location&gt;
  &lt;location path="." inheritInChildApplications="false"&gt;
    &lt;system.webServer&gt;    
      &lt;validation validateIntegratedModeConfiguration="false" /&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"&gt;
        &lt;remove name="FormsAuthentication" /&gt;
      &lt;/modules&gt;
      &lt;staticContent&gt;
        &lt;remove fileExtension=".eot" /&gt;
        &lt;remove fileExtension=".ttf" /&gt;
        &lt;remove fileExtension=".otf" /&gt;
        &lt;remove fileExtension=".woff" /&gt;
        &lt;remove fileExtension=".woff2" /&gt;
        &lt;mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /&gt;
        &lt;mimeMap fileExtension=".ttf" mimeType="font/ttf" /&gt;
        &lt;mimeMap fileExtension=".otf" mimeType="font/otf" /&gt;
        &lt;mimeMap fileExtension=".woff" mimeType="application/font-woff" /&gt;
        &lt;mimeMap fileExtension=".woff2" mimeType="application/font-woff" /&gt;
        &lt;clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="14.00:00:00" /&gt;
      &lt;/staticContent&gt;
      &lt;security&gt;
        &lt;requestFiltering&gt;
          &lt;hiddenSegments&gt;
            &lt;add segment="ClearScript.V8" /&gt;
          &lt;/hiddenSegments&gt;
        &lt;/requestFiltering&gt;
      &lt;/security&gt;
      &lt;handlers&gt;
        &lt;remove name="Babel" /&gt;
        &lt;add name="Babel" verb="GET" path="*.jsx" type="React.Web.BabelHandlerFactory, React.Web" preCondition="integratedMode" /&gt;
      &lt;/handlers&gt;     
      &lt;directoryBrowse enabled="false" /&gt;
    &lt;/system.webServer&gt;
  &lt;/location&gt;  
  &lt;runtime&gt;
    &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
      &lt;/dependentAssembly&gt;
    &lt;/assemblyBinding&gt;
  &lt;/runtime&gt;
  &lt;entityFramework&gt;
    &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
    &lt;providers&gt;
      &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
    &lt;/providers&gt;
  &lt;/entityFramework&gt;
  &lt;jsEngineSwitcher xmlns="http://tempuri.org/JavaScriptEngineSwitcher.Configuration.xsd"&gt;
    &lt;core&gt;
      &lt;engines&gt;
        &lt;add name="MsieJsEngine" type="JavaScriptEngineSwitcher.Msie.MsieJsEngine, JavaScriptEngineSwitcher.Msie" /&gt;
        &lt;add name="V8JsEngine" type="JavaScriptEngineSwitcher.V8.V8JsEngine, JavaScriptEngineSwitcher.V8" /&gt;
      &lt;/engines&gt;
    &lt;/core&gt;
  &lt;/jsEngineSwitcher&gt;
&lt;/configuration&gt;
</code></pre>

<p>We've tried everything we can find online and nothing is working :( Would really appreciate some help!</p>