If someone comes across this question on Google and is having problems with the web.config sample mentioned in the accepted answer ...
This is the web.config file that worked for me:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="iisnode" path="server/app.js" verb="*" modules="iisnode" /> </handlers> <rewrite> <rules> <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true"> <match url="iisnode" /> </rule> <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> <match url="^server\/app.js\/debug[\/]?" /> </rule> <rule name="StaticContent" patternSyntax="ECMAScript" stopProcessing="true"> <match url=".*" /> <action type="Rewrite" url="public/{C:1}" logRewrittenUrl="true" /> <conditions> <add input="{REQUEST_URI}" pattern=".*?virtualpath\/(.*)" /> </conditions> </rule> <rule name="DynamicContent" patternSyntax="ECMAScript"> <match url=".*" /> <conditions> <add input="{{REQUEST_FILENAME}}" matchType="IsFile" negate="True" /> </conditions> <action type="Rewrite" url="server/app.js" logRewrittenUrl="true" /> </rule> </rules> </rewrite> <security> <requestFiltering> <hiddenSegments> <add segment="node_modules" /> </hiddenSegments> </requestFiltering> </security> </system.webServer> </configuration>
My folder structure:
- virtualpath / - refers to the configured IIS virtual path
- public / - contains static content
- server / - contains server application files
Mark t
source share