0

I am trying to deploy a node.js application to IIS 7.0 hosted on Windows 2008 machine using the IISNode module. I have the following web.config file -

<configuration>
    <system.webServer>
    <webSocket enabled="false" />
    <handlers>
       <add name="iisnode" path="build/index.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="^build\/server.js\/debug[\/]?" />
        </rule>

        <rule name="StaticContent">
           <action type="Rewrite" url="public{REQUEST_URI}"/>
        </rule>

        <!-- All other URLs are mapped to the node.js site entry point -->
        <rule name="DynamicContent">
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
            </conditions>
            <action type="Rewrite" url="build/index.js"/>
        </rule>
      </rules>
    </rewrite>

<security>
  <requestFiltering>
    <hiddenSegments>
      <remove segment="bin"/>
    </hiddenSegments>
  </requestFiltering>
</security>
<httpErrors existingResponse="PassThrough" /></system.webServer></configuration>

When I navigate to the site - it gives a HTTP Error 500.19 internal server error complaining about invalid web.config. This exact config is working on azure wep app without any issue. I've also installed the Rewrite module.

If anyone has run into this issue and any help would be greatly appreciated.

Many Thanks.

EDITED - Problem was with the following line -

<webSocket enabled="false" />

Removing that fixed the issue. But I got following error when trying to access the site -

iisnode was unable to establish named pipe connection to the node.exe process before the process terminated

Ravi B.
  • 11
  • 5

2 Answers2

0

how about this web.config?

  <configuration>
<rewrite>      
<rules>
    <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
    <rule name="StaticContent">
      <action type="Rewrite" url="public{REQUEST_URI}"/>
    </rule>

    <!-- All other URLs are mapped to the node.js site entry point -->
    <rule name="DynamicContent">
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
      </conditions>
      <action type="Rewrite" url="build/index.js"/>
    </rule>
  </rules>
</rewrite>

<!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
<security>
  <requestFiltering>
    <hiddenSegments>
      <remove segment="bin"/>
    </hiddenSegments>
  </requestFiltering>
</security>

<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />

<!--
  You can control how Node is hosted within IIS using the following options:
    * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
    * node_env: will be propagated to node as NODE_ENV environment variable
    * debuggingEnabled - controls whether the built-in debugger is enabled

  See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
  </configuration>
farhadamjady
  • 982
  • 6
  • 14
0

Basically the last issue was a permissions issue in my case - I had to give full-control to the IIS_Users group to the node app folder and it worked for me.

Thank you.

Ravi B.
  • 11
  • 5