title: Express 4 app doesn't work in Azure when deployed via Visual Studio
body: <p>I have a node js express app generated from Visual Studio 2017 Basic Azure Node.js Express Application. I assume all the configuration required for Azure deployment is set in the Web.config file that comes with the template, but i am getting this error after Azure publish:</p>
  
  <blockquote>
    <p>iisnode encountered an error when processing the request.
    HRESULT: 0x2 HTTP status: 500 HTTP subStatus: 1002 HTTP reason:
    Internal Server Error You are receiving this HTTP 200 response because
    system.webServer/iisnode/@devErrorsEnabled configuration setting is
    'true'.</p>
    
    <p>In addition to the log of stdout and stderr of the node.exe process,
    consider using debugging and ETW traces to further diagnose the
    problem.</p>
    
    <p>The node.exe process has not written any information to stderr or
    iisnode was unable to capture this information. Frequent reason is
    that the iisnode module is unable to create a log file to capture
    stdout and stderr output from node.exe. Please check that the identity
    of the IIS application pool running the node.js application has read
    and write access permissions to the directory on the server where the
    node.js application is located. Alternatively you can disable logging
    by setting system.webServer/iisnode/@loggingEnabled element of
    web.config to 'false'.</p>
  </blockquote>
  
  <p>If i publish the app without modifying anything, it works well, but the moment i add my static files, and add relevant modules, it starts giving me the error above. Below is my web.config file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
    For more information on how to configure your Node.js application, please visit
    http://go.microsoft.com/fwlink/?LinkId=290972
    --&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;!--
      &lt;add key="StorageAccountName" value="" /&gt;
      &lt;add key="StorageAccountKey" value="" /&gt;
      &lt;add key="ServiceBusNamespace" value="" /&gt;
      &lt;add key="ServiceBusIssuerName" value="" /&gt;
      &lt;add key="ServiceBusIssuerSecretKey" value="" /&gt;
      --&gt;
    &lt;/appSettings&gt;
    &lt;system.webServer&gt;
      &lt;!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. --&gt;
      &lt;staticContent&gt;
        &lt;mimeMap fileExtension=".svg" mimeType="image/svg+xml" /&gt;
      &lt;/staticContent&gt;
  
      &lt;modules runAllManagedModulesForAllRequests="false" /&gt;
  
      &lt;!-- Web.Debug.config adds attributes to this to enable remote debugging when publishing in Debug configuration. --&gt;
      &lt;iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"/&gt;
  
      &lt;!-- Remote debugging (Azure Website with git deploy): Comment out iisnode above, and uncomment iisnode below. --&gt;
      &lt;!--&lt;iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"
        loggingEnabled="true"
        devErrorsEnabled="true"
        nodeProcessCommandLine="node.exe &amp;#45;&amp;#45;debug"/&gt;--&gt;
  
      &lt;!-- indicates that the server.js file is a Node.js application 
      to be handled by the iisnode module --&gt;
      &lt;handlers&gt;
        &lt;add name="iisnode" path="app.js" verb="*" modules="iisnode" /&gt;
  
        &lt;!-- Remote debugging (Azure Website with git deploy): Uncomment NtvsDebugProxy handler below.
        Additionally copy Microsoft.NodejsTools.WebRole to 'bin' from the Remote Debug Proxy folder.--&gt;
        &lt;!--&lt;add name="NtvsDebugProxy" path="ntvs-debug-proxy/67499f58-9ba1-441d-b23f-6d860606ddb5" verb="*" resourceType="Unspecified"
          type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"/&gt;--&gt;
      &lt;/handlers&gt;
  
      &lt;security&gt;
        &lt;requestFiltering&gt;
          &lt;hiddenSegments&gt;
            &lt;remove segment="bin" /&gt;
          &lt;/hiddenSegments&gt;
        &lt;/requestFiltering&gt;
      &lt;/security&gt;
  
      &lt;rewrite&gt;
        &lt;rules&gt;
          &lt;clear /&gt;
          &lt;!-- Remote debugging (Azure Website with git deploy): Uncomment the NtvsDebugProxy rule below. --&gt; 
          &lt;!--&lt;rule name="NtvsDebugProxy" enabled="true" stopProcessing="true"&gt; 
            &lt;match url="^ntvs-debug-proxy/.*"/&gt; 
          &lt;/rule&gt;--&gt; 
  
          &lt;!-- Don't interfere with requests for node-inspector debugging --&gt;
          &lt;rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"&gt;
            &lt;match url="^server.js\/debug[\/]?" /&gt;
          &lt;/rule&gt;
  
          &lt;rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true"&gt;
            &lt;match url="iisnode.+" negate="true" /&gt;
            &lt;conditions logicalGrouping="MatchAll" trackAllCaptures="false" /&gt;
            &lt;action type="Rewrite" url="app.js" /&gt;
          &lt;/rule&gt;
        &lt;/rules&gt;
      &lt;/rewrite&gt;
    &lt;/system.webServer&gt;
  
    &lt;!-- Remote debugging (Azure Website with git deploy): uncomment system.web below --&gt; 
    &lt;!--&lt;system.web&gt; 
      &lt;httpRuntime targetFramework="4.5"/&gt; 
      &lt;customErrors mode="Off"/&gt; 
    &lt;/system.web&gt;--&gt; 
  &lt;/configuration&gt;
  </code></pre>