如何在 IIS 中部署 angular Universal?
我在 IIS 中部署 angular 通用应用程序时遇到问题.在 angular Universal 中创建了两个 dist 文件夹,一个是客户端的 dist,另一个是 dist-server,当我尝试托管时,我提供了 dist 文件夹的路径,站点正在运行,但页面未从服务器呈现.
I am facing problem with deploying angular universal application in IIS. In angular universal two dist folder is created one is dist for client and another is dist-server, when I try to host , I am giving path of dist folder ,site is running but pages not rendered from server.
我遇到了同样的问题,不是我找到了解决方案,但我想我找到了为什么没有解决方案的原因,至少目前是这样.
I had the same problem, not that I found the solution, but I guess I found why there is no solution, at least for now.
这里有一些需要学习的东西,它们将有助于理解为什么不应该尝试在 IIS 下托管 Angular SSR.
Here are a few things to learn that will help realize why you should not try host Angular SSR under IIS.
首先要意识到的是,当您构建常规"Angular 应用程序时,您将获得可以托管在几乎任何服务器上的典型文件集.TBH,我对很多服务器都不熟悉,但是您当然可以使用 IIS 托管这些服务器.但是当你在 SSR 模式下构建 Angular 时,你会得到应该用 Node.js 托管的文件
The first thing to realize is that when you build a 'regular' Angular application you get typical set of file that you can host at pretty much any server. TBH, I'm not familiar with many servers, but you can certainly host those with IIS. But when you build Angular in SSR mode, you get files that are supposed to be hosted with Node.js
要在 SSR 模式下托管 Angular,您可以创建 ASP.NET Angular 应用程序,并将其转换为 SSR 模式.不幸的是,这似乎在 .NET 5 中停止工作(至少这也是许多其他人所抱怨的:我会提供一些链接,但我没有这些链接)
To host Angular in SSR mode, you could create ASP.NET Angular application, and turn it into SSR mode. Unfortunately, seems like this stopped working in .NET 5 (at least this is what many other people complain about as well: I'd provide a few links but I don't have those handy)
我认为选择是等待 MS 在 .NET 5 中实现对 SSR Angular 的支持.与此同时,将它托管在 Node.js 下可能是一个好主意.
I think the option is to wait for MS to implement support for SSR Angular in .NET 5. In the meantime, probably a good idea is to host it under Node.js.
附言我不是这个主题的专家,只是分享我到目前为止学到的东西.如果有人可以填补空白或纠正我,我会很感激.谢谢!
P.S. I'm not a guru on this topic, just shared what I've learned so far. If someone can fill in gaps or correct me, I'd appreciated it. Thanks!