简体   繁体   English

在IIS中托管Angular Universal时出错:iisnode在处理请求时遇到错误

[英]Error in hosting Angular Universal in IIS : iisnode encountered an error when processing the request

I was trying to change my Angular 8 meta tags dynamically for facebook sharing.我试图为 facebook 共享动态更改我的 Angular 8 元标记。
I have the back-end API on C#.我在 C# 上有后端 API。
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.因此,我正在尝试在 Windows Server 2019 的 IIS 中托管我的 Angular 8 通用应用程序。
I have the dist folder, main.js and web.config file in the root directory of the hosted site.我在托管站点的根目录中有 dist 文件夹 main.js 和 web.config 文件。
I have installed the iisnode in the server.我已经在服务器中安装了 iisnode。
When I browse the site a blank iisnode folder is created on the root directory.当我浏览该站点时,会在根目录中创建一个空白 iisnode 文件夹。
I have set the full control permissions to IIS_IUSR and IUSR to the root directory.我已将 IIS_IUSR 和 IUSR 的完全控制权限设置为根目录。
But I am getting the following errors:但我收到以下错误:

Error错误

My folder structure is as follows:我的文件夹结构如下:

Folder文件夹

My web.config is as follows:我的 web.config 如下:

<?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 Files\nodejs\node.exe" interceptor="C:\Program Files\iisnode\interceptor.js" />
</system.webServer>
  </configuration>

I am stuck with the issue and not able to proceed.我被这个问题困住了,无法继续。
Please help me.请帮我。

UPDATE (23-12-2021):更新(2021 年 12 月 23 日):
I made some changes in angular code and that issue is fixed.我对 angular 代码进行了一些更改,该问题已修复。 But a new error is shown which is as follows:但是会显示一个新错误,如下所示:

iisnode encountered an error when processing the request. iisnode 在处理请求时遇到错误。

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'. 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.除了node.exe进程的stdout和stderr的日志,考虑使用debugging和ETW traces来进一步诊断问题。

The last 64k of the output generated by the node.exe process to stderr is shown below: node.exe进程生成到stderr的output最后64k如下图:

Application has thrown an uncaught exception and is terminated: Error: Cannot find module 'zone.js/dist/zone-node' Require stack:应用程序抛出未捕获的异常并终止:错误:找不到模块'zone.js/dist/zone-node'需要堆栈:

  • C:\inetpub\wwwroot\AdvAngularServer\main.js C:\inetpub\wwwroot\AdvAngularServer\main.js
  • C:\Program Files (x86)\iisnode\interceptor.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:\inetpub\wwwroot\AdvAngularServer\main.js:1:6605) at webpack_require (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:317) at Module.uj+Y (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:21026) at webpack_require (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:317) at Object.0 (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:2902) at webpack_require (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:317) C:\Program Files (x86)\iisnode\interceptor.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Function.Module._load (internal/modules/cjs/loader. js:725:27) 在 Module.require (internal/modules/cjs/loader.js:952:19) 在 require (internal/modules/cjs/helpers.js:88:18) 在 Object.b6Xn (C:\ inetpub\wwwroot\AdvAngularServer\main.js:1:6605) 在webpack_require (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:317) 在 Module.uj+Y (C:\inetpub\wwwroot\AdvAngularServer\ main.js:1:21026) 在webpack_require (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:317) 在 Object.0 (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:2902)在webpack_require (C:\inetpub\wwwroot\AdvAngularServer\main.js:1:317)

Any idea please?请问有什么想法吗?

there is a user "NetworkServices" or something like that... You already tried to add this user to the windows permissions?有一个用户“NetworkServices”或类似的东西......您已经尝试将此用户添加到 windows 权限? I had problems with wordpress, that i could solve with it.我遇到了 wordpress 的问题,我可以用它解决。

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我认为您没有 dist 文件夹的权限,或者您的模块 zone-node 的代码路径错误

I fixed the issue by adding --bundleDependencies all in the package.json.我通过在 package.json 中添加--bundleDependencies all解决了这个问题。
Thanks.谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iisnode在处理请求时遇到错误 - iisnode encountered an error when processing the request iisnode 在处理请求时遇到错误。 HTTP 状态:500 - iisnode encountered an error when processing the request. HTTP status: 500 iisnode在处理请求时遇到错误。 HRESULT:0x6d HTTP状态:500 HTTP子状态:1013 - iisnode encountered an error when processing the request. HRESULT: 0x6d HTTP status: 500 HTTP subStatus: 1013 Windows 7 IIS 7.5上的iisnode抛出500.19错误 - iisnode on windows 7 IIS 7.5 throwing 500.19 error 使用IISNode在IIS中托管回送API - Hosting a Loopback API in IIS using IISNode 在 IIS 中托管时,Angular Universal 应用程序不显示服务器端 - Angular Universal app doesn't show server side when hosting in IIS 无法正常工作-在IIS上部署节点应用程序(iisnode)-找回403错误 - Not working - deploying node application on IIS (iisnode) - Getting back 403 error 使用IISNode在IIS中托管Node.js应用程序时如何启用静态文件(和较少的支持) - How to enable static files (and less support) when hosting a nodejs app within IIS using IISNode 在IIS中托管Nodejs网站时出错 - Error for hosting Nodejs website in IIS 如何更正 IISNode HTTP 500 substatus 1002 进程请求错误 - How to correct IISNode HTTP 500 substatus 1002 process request error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM