2017-12-18 95 views
0

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

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

回答

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>