在 Azure 上部署后,Angular 应用程序的应用程序图像未显示

问题描述 投票:0回答:1

我有一个 Angular 应用程序部署在本地(Window Serve)上,并且运行良好。但是,一旦我使用应用程序服务在 Azure 上部署该应用程序,图像就不会显示。

在 Azure 上,内容/类型显示为 text/html。

enter image description here

在 Prem 上,内容/类型显示图像/png enter image description here

需要显示图像。

azure azure-devops azure-web-app-service
1个回答
0
投票

以下是我使用 Azure DevOps 将 Angular 应用程序部署到 Azure Static Web Apps 所采取的步骤,供您参考。

  1. 我正在使用示例代码here。将存储库导入到我的 Azure 存储库。我将
    home.png
    文件添加到
    index.html
    文件中。
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Hello</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <p>This is a png:</p>
  <img src="assets/home.png" alt="Home Image">
</head>
<body>
  <app-root></app-root>
</body>
</html>
  1. 按照此处的步骤创建静态 Web 应用程序。将自动创建 DevOps 管道来部署应用程序。

  2. 然后我就可以看到按预期显示的图像。

© www.soinside.com 2019 - 2024. All rights reserved.