我已根据the Angular docs和the suggestion on SO在Azure中将我的IIS服务器定义为 index.html 。部署基于this blog about Angular in Azure执行。在文档中说,除非绝对需要,否则不应该使用哈希策略。所以我确保在 index.html 中添加了 ,并添加了 web.config ,如下所示。
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
可悲的是,尽管本地服务按预期工作,但上传的版本不会产生以下错误。
由于发生内部服务器错误,无法显示页面。
我不确定如何更深入地解决问题,尽管我在上一个问题上收到了一些提示(导致我意识到我需要配置后备页面)。
答案 0 :(得分:0)
由于您的应用可以在本地工作,但在部署到azure Web应用后它无效。对于这种情况,您最好enable diagnostics logging for web apps in Azure App Service检索详细错误以缩小此问题的范围。您还可以使用详细错误更新您的问题,以便我们解决此问题。