Facebook
From Jason Pan, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 460
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3.      This configuration file is required if iisnode is used to run node processes behind
  4.      IIS or IIS Express.  For more information, visit:
  5.  
  6.      https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
  7. -->
  8.  
  9. <configuration>
  10.   <system.webServer>
  11.     <!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
  12.     <webSocket enabled="false" />
  13.     <handlers>
  14.       <!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
  15.       <add name="iisnode" path="bin/www" verb="*" modules="iisnode"/>
  16.     </handlers>
  17.     <rewrite>
  18.       <rules>
  19.         <!-- Do not interfere with requests for node-inspector debugging -->
  20.         <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
  21.           <match url="^bin/www\/debug[\/]?" />
  22.         </rule>
  23.  
  24.         <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
  25.         <rule name="StaticContent">
  26.           <action type="Rewrite" url="public{PATH_INFO}"/>
  27.         </rule>
  28.  
  29.         <!-- All other URLs are mapped to the node.js site entry point -->
  30.         <rule name="DynamicContent">
  31.           <conditions>
  32.             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
  33.           </conditions>
  34.           <action type="Rewrite" url="bin/www"/>
  35.         </rule>
  36.       </rules>
  37.     </rewrite>
  38.    
  39.     <!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
  40.     <security>
  41.       <requestFiltering>
  42.         <hiddenSegments>
  43.           <remove segment="bin"/>
  44.         </hiddenSegments>
  45.       </requestFiltering>
  46.     </security>
  47.  
  48.     <!-- Make sure error responses are left untouched -->
  49.     <httpErrors existingResponse="PassThrough" />
  50.  
  51.     <!--
  52.       You can control how Node is hosted within IIS using the following options:
  53.         * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
  54.         * node_env: will be propagated to node as NODE_ENV environment variable
  55.         * debuggingEnabled - controls whether the built-in debugger is enabled
  56.  
  57.       See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
  58.     -->
  59.     <!--<iisnode watchedFiles="web.config;*.js"/>-->
  60.   </system.webServer>
  61. </configuration>
  62.