node.jswindowsiis-10iisnode

How to host Node JS app on IIS 10 with Windows Server 2019


I have configured all those things which are necessary for iisnode. But when i browse the site through http://localhost/Backend (Backend is a site name hosted on iis) then nothing is being happened and page keeps loading.

My web.config:

    <?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
        <add name="iisnode" path="index.js" verb="*" modules="iisnode" />
    </handlers>
    <rewrite>
        <rules>
                <rule name="nodejs">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" ignoreCase="true" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/index.js" />
                </rule>
        </rules>
    </rewrite>
    <security>
    <requestFiltering>
        <hiddenSegments>
            <add segment="node_modules" />
        <add segment="iisnode" />
        </hiddenSegments>
    </requestFiltering>
    </security>
    </system.webServer>
</configuration>

Solution

  • Try to set the Application Pools-> Idle Time-Out to "0" by advance setting and check what is the exact issue. make sure you installed the iisnode module.

    iisnode module indicates that the index.js file is a node.js application to be handled by the iisnode module.

    link:

    https://forums.asp.net/t/2145697.aspx?deploy+nodejs+web+api+in+IIS+server

    https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config