0
votes

I have upgraded my Angular 7 project to Angular 9. I ran the following commands "ng add @nguniversal/express-engine", “npm run build: ssr" and "npm run serve: ssr”. It worked fine in my local environment. "dist" folder created and deployed to IIS on webserver.

Now, IIS website is pointing to "dist" folder, this folder contains "browser", "server" folders and web.config file. Find the below web.config file, it is pointing to "server/main.js" file. When i execute my application it is throwing HTTP 500 error.

Please help me how to deploy this "dist" folder to IIS on webserver.

web.config


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.webServer>        
        <webSocket enabled="false" />
        <handlers>
            <add name="iisnode" path="server/main.js" verb="*" modules="iisnode" />
        </handlers>
        <rewrite>
            <rules>
                <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url="^server.js\/debug[\/]?" />
                </rule>
                <rule name="StaticContent">
                    <action type="Rewrite" url="public{REQUEST_URI}" />
                </rule>
                <rule name="DynamicContent" stopProcessing="true">
            <match url=".*" />
                    <conditions>                        
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="server/main.js/{R:0}"  />
                </rule>
            </rules>
        </rewrite>
        <security>
            <requestFiltering>
                <hiddenSegments>
                    <remove segment="bin" />
                </hiddenSegments>
            </requestFiltering>
        </security>
        <httpErrors existingResponse="PassThrough" />
        <iisnode nodeProcessCommandLine="C:\Program Files\nodejs\node.exe"
            watchedFiles="web.config;*.js" 
            node_env="%node_env%" 
            loggingEnabled="true" 
            logDirectory="iisnode" 
            debuggingEnabled="true" 
            maxLogFileSizeInKB="1048" 
            maxLogFiles="50" 
            devErrorsEnabled="true" />
    </system.webServer>
</configuration>


1
Don't you have any logs somewhere?David

1 Answers

-1
votes

Use the following command to build the application. build:client-and-server-bundles