【发布时间】:2017-12-19 10:48:34
【问题描述】:
使用 Ng Build 命令我已将 Angular-4 应用程序发布到 dist 文件夹中。然后上传到 Azure Web App。所有文件都正确上传到 IIS 服务器。这是来自 KUDU 网站的图片。
【问题讨论】:
使用 Ng Build 命令我已将 Angular-4 应用程序发布到 dist 文件夹中。然后上传到 Azure Web App。所有文件都正确上传到 IIS 服务器。这是来自 KUDU 网站的图片。
【问题讨论】:
你检查过你的 index.html,尤其是基本的 href 吗?
【讨论】:
您是否定义了 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>
【讨论】: