Skip to content

Instantly share code, notes, and snippets.

@mahya8585
Created September 30, 2016 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahya8585/4782cd56224f34313ee6368a59dcecd2 to your computer and use it in GitHub Desktop.
Save mahya8585/4782cd56224f34313ee6368a59dcecd2 to your computer and use it in GitHub Desktop.
Node.js用web.configの例
<?xml version="1.0" encoding="utf-8"?>
<!--このファイルをwwwroot直下に置く-->
<configuration>
<system.webServer>
<!-- 既存websocketの切断-->
<webSocket enabled="false" />
<handlers>
<!-- Nodejsを設定。webappsではapp.jsにデフォルトで読みに行く。別のjs名の場合はpathを変更する。 以降のapp.jsと書いてある部分は全て変更のこと。-->
<add name="iisnode" path="app.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^app.js\/debug[\/]?" />
</rule>
<!-- パス設定 -->
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="app.js"/>
</rule>
</rules>
</rewrite>
<!-- node.jsでは使わないディレクトリ -->
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<httpErrors existingResponse="PassThrough" />
<!--<iisnode watchedFiles="web.config;*.js"/>-->
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment