title: Set Node.js Environment Variable (NODE_ENV) in iisnode to Production/Development/Test
body: <p>How do we tell iisnode to run our Node.js application environment in production/development/test?</p>
  
  <p>We have successfully gotten our Node.js app running with iisnode but <code>process.env.NODE_ENV</code> is coming out as 'undefined'.</p>
  
  <p>At the moment, our web.config file is written this way:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;system.webServer&gt;
  
      &lt;handlers&gt;
        &lt;add name="iisnode" path="app.js" verb="*" modules="iisnode" /&gt;
      &lt;/handlers&gt;
  
      &lt;rewrite&gt;
        &lt;rules&gt;
          &lt;rule name="app"&gt;
            &lt;match url="/*" /&gt;
            &lt;action type="Rewrite" url="app.js" /&gt;
          &lt;/rule&gt;
        &lt;/rules&gt;
      &lt;/rewrite&gt;
  
      &lt;security&gt;
        &lt;requestFiltering&gt;
          &lt;hiddenSegments&gt;
            &lt;add segment="node_modules" /&gt;
          &lt;/hiddenSegments&gt;
        &lt;/requestFiltering&gt;
      &lt;/security&gt;    
  
    &lt;/system.webServer&gt;
    &lt;appSettings&gt;
      &lt;add key="NODE_ENV" value="production" /&gt;
    &lt;/appSettings&gt;
  &lt;/configuration&gt;
  </code></pre>