【问题标题】:SPA application on IIS Azure App ServiceIIS Azure 应用服务上的 SPA 应用程序
【发布时间】:2017-05-18 13:05:26
【问题描述】:
我已经直接从我的 git 存储库配置了我的 HTML/JS SPA 到 Azure 应用服务的部署。效果很好,除了如果我从浏览器打开让我们说“/登录”,则没有重定向到“/”。相反,我看到的是 404。
问题是,如果找不到页面,如何配置 IIS 以显示“/index.html”以便“显示什么?”是在客户端处理的?
【问题讨论】:
标签:
asp.net
azure
iis
azure-web-app-service
single-page-application
【解决方案1】:
根据您的描述,我建议您可以在 Web 配置中添加元素,以允许您为您的网站或应用程序配置自定义错误页面。
我建议你可以使用 KUDU 控制台将 wwwrot 文件夹本地化并添加一个 web.config 文件,如下所示:
<configuration>
<system.webServer>
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Auto" defaultResponseMode="ExecuteURL" >
<remove statusCode="404"/>
<error statusCode="404" responseMode="ExecuteURL" path="/index.html" />
</httpErrors>
</system.webServer>
</system.webServer>
</configuration>