Deploy Angular Universal to IIS

I am having a problem deploying my Node.js to the IIS, in my web.config:

> <handlers>
>         <add name="iisnode-ng-universal" path="dist/server.js" verb="*" modules="iisnode" />
>     </handlers>

 <rule name="ng-universal" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{HTTP_HOST}" pattern="test" />
        <action type="Rewrite" url="dist/server.js" />

I am getting this error:

enter image description here

This how my web files tree looks:

web files

I tried to give full permission to IIS_IUSRS and IUSR but it does not seem to work. Like this post suggested: iisnode encountered an error when processing the request


  • can you try the below code.. it works for me

    <?xml version="1.0" encoding="utf-8"?>
            <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
                <rule name="DynamicContent">
                     <match url="/*" />
                     <action type="Rewrite" url="server.js"/>

    Your server.js can be outside the dist folder.