0

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>


2
  • Don't you have any logs somewhere? Commented Jun 8, 2020 at 17:22
  • did u get the solution for it ? Commented Jan 25, 2023 at 10:01

1 Answer 1

-2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.