I was trying to change my Angular 8 meta tags dynamically for facebook sharing.
I have the back-end API on C#.
But I could not found any solution anywhere except the option of converting the existing app into server-side.
So, I am trying to host my Angular 8 universal app in the IIS of Windows Server 2019.
I have the dist folder, main.js and web.config file in the root directory of the hosted site.
I have installed the iisnode in the server.
When I browse the site a blank iisnode folder is created on the root directory.
I have set the full control permissions to IIS_IUSR and IUSR to the root directory.
But I am getting the following errors:
My folder structure is as follows :
My web.config is as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="main.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="DynamicContent">
<match url="/*" />
<action type="Rewrite" url="main.js" />
</rule>
<rule name="StaticContent" stopProcessing="true">
<match url="([S]+[.](jpg|jpeg|gif|css|png|js|ts|cscc|less|ico|html|map|svg))" />
<action type="None" />
</rule>
</rules>
</rewrite>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" />
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".ttf" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<remove fileExtension=".otf" />
<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/x-woff" />
<mimeMap fileExtension=".otf" mimeType="application/otf" />
</staticContent>
<iisnode node_env="production" nodeProcessCountPerApplication="0" nodeProcessCommandLine="C:Program Filesnodejsnode.exe" interceptor="C:Program Filesiisnodeinterceptor.js" />
</system.webServer>
</configuration>
I am stuck with the issue and not able to proceed.
Please help me.
UPDATE (23-12-2021):
I made some changes in angular code and that issue is fixed. But a new error is shown which is as follows :
iisnode encountered an error when processing the request.
HRESULT: 0x2 HTTP status: 500 HTTP subStatus: 1002 HTTP reason:
Internal Server Error You are receiving this HTTP 200 response because
system.webServer/iisnode/@devErrorsEnabled configuration setting is
‘true’.In addition to the log of stdout and stderr of the node.exe process,
consider using debugging and ETW traces to further diagnose the
problem.The last 64k of the output generated by the node.exe process to stderr
is shown below:Application has thrown an uncaught exception and is terminated: Error:
Cannot find module ‘zone.js/dist/zone-node’ Require stack:
- C:inetpubwwwrootAdvAngularServermain.js
- C:Program Files (x86)iisnodeinterceptor.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.b6Xn (C:inetpubwwwrootAdvAngularServermain.js:1:6605)
at webpack_require (C:inetpubwwwrootAdvAngularServermain.js:1:317)
at Module.uj+Y (C:inetpubwwwrootAdvAngularServermain.js:1:21026)
at webpack_require (C:inetpubwwwrootAdvAngularServermain.js:1:317)
at Object.0 (C:inetpubwwwrootAdvAngularServermain.js:1:2902)
at webpack_require (C:inetpubwwwrootAdvAngularServermain.js:1:317)
Any idea please?
2
Answers
I fixed the issue by adding
--bundleDependencies all
in the package.json.Thanks.
there is a user "NetworkServices" or something like that… You already tried to add this user to the windows permissions? I had problems with wordpress, that i could solve with it.
I think you do not have the permission to the dist folder, or you have the wrong path in code to the module zone-node