简体   繁体   English

Angular Azure应用服务SSR配置

[英]Angular SSR configuration on Azure app service

I work with angular v10 SSR with .net core 3.1.我使用 angular v10 SSR 和 .net 核心 3.1。 Downloaded the sample code from here: https://angular.io/guide/universal and deployed to Azure Appservice.从这里下载示例代码: https://angular.io/guide/universal并部署到 Azure Appservice。 On azure Appservice Node.js run and start server/main.js.在 azure Appservice Node.js 上运行并启动 server/main.js。

here is the result:这是结果: 在此处输入图像描述

My questions:我的问题:

  • Is the correct way of working like: first time load static files SSR and then switch to CSR?正确的工作方式是:第一次加载 static 文件 SSR 然后切换到 CSR?
  • On the picture left side: the app running on localhost, and the cURL shows the content before browser would replace it with CSR components.左图:app运行在localhost,cURL显示的是浏览器替换CSR组件之前的内容。 here <app-root> tag contains the static files which works correctly.这里<app-root>标签包含 static 文件,可以正常工作。 After deploy to Azure Appservice its contains only <app-root></app-root> empty tag.部署到 Azure Appservice 后,它只包含<app-root></app-root>空标签。 Is it works correctly?它工作正常吗?
  • Any Idea why show only <app-root></app-root> on appservice?知道为什么只在 appservice 上显示<app-root></app-root>吗?

Thanks cyr_x Your answer helped lot.谢谢cyr_x你的回答很有帮助。

Remove the NgModule decorator from your imports section.imports部分移除NgModule装饰器。 Also remove the AppComponent from the imports of your module.同时从模块的imports中删除AppComponent

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    MaterialModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
}

The imports attribute should only contain classes which are decorated with NgModule . imports属性应该只包含用NgModule装饰的类。

暂无
暂无

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

相关问题 无法从 Azure App 服务配置应用程序设置中读取 Azure SignalR 连接字符串 - Unable to read Azure SignalR Connection String from Azure App Service Configuration Application Settings 如何从 C# 代码获取和设置 Azure 应用服务配置设置? - How to get and set Azure app service configuration settings from C# code? 如何读取Service Fabric Azure App Configuration ASP.NET Core Stateless Web API? - How to read the Azure App Configuration in Service Fabric ASP.NET Core Stateless Web API? 读取应用服务的配置部分 - Reading Configuration Section of an App Service 如何从 .Net Frame Asp.Net 应用程序中的 Azure App Service 配置获取连接字符串? - How do I get a connection string from Azure App Service configuration in a .Net Frame Asp.Net application? Azure function CORS 配置 SignalR 服务不工作 - Azure function CORS configuration with SignalR Service not working 如何使用 Java SDK 从我的远程 Azure 应用程序配置中检索服务总线队列的队列名称? - How can I retrieve the queue name for a service bus queue from my remote Azure App Configuration using the Java SDK? Angular 12 app Azure app service (windows) not rendering any CSS. Works fine locallay - Angular 12 app Azure app service (windows) not rendering any CSS. Works fine locallay 将带有wsHttpBinding的WCF服务迁移到Azure应用服务 - Migrating WCF service with wsHttpBinding to Azure App Service Azure Static 使用 React Router 配置 App Route - Azure Static App Route configuration with React Router
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM