【问题标题】:Publish Angular 4 to Azure将 Angular 4 发布到 Azure
【发布时间】:2017-12-19 10:48:34
【问题描述】:

使用 Ng Build 命令我已将 Angular-4 应用程序发布到 dist 文件夹中。然后上传到 Azure Web App。所有文件都正确上传到 IIS 服务器。这是来自 KUDU 网站的图片。

但是 Chrome 无法找到这些文件。控制台中的错误是 404。奇怪! 任何指向正确方向的指针都将不胜感激。

【问题讨论】:

    标签: angular azure


    【解决方案1】:

    你检查过你的 index.html,尤其是基本的 href 吗?

    【讨论】:

      【解决方案2】:

      您是否定义了 web.config 文件?没有它,IIS 将不知道在哪里查找文件 (index.html)。

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration>
      <system.webServer>
      <staticContent>
          <mimeMap fileExtension="json" mimeType="application/json" />
          <mimeMap fileExtension="woff" mimeType="application/font-woff" />
          <mimeMap fileExtension="woff2" mimeType="application/font-woff" />
      </staticContent>             
          <rewrite>
              <rules>
                  <rule name="SPA" stopProcessing="true">
                      <match url=".*\.(js|json|txt|css|map|html|ttf|woff|woff2|eot|svg|png)$" negate="true" />
                      <action type="Rewrite" url="index.html" />
                  </rule>
              </rules>
          </rewrite>
      </system.webServer>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-01-18
        • 2016-11-14
        相关资源
        最近更新 更多