将Angular 4发布到Azure

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

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

但Chrome无法找到这些文件。控制台中的错误是404.奇怪!任何指向正确方向的人都会非常感激。 enter image description here

angular azure
2个回答
1
投票

你检查了你的index.html,尤其是基础href?


1
投票

你有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>

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