gpt4 book ai didi

asp.net - IIS Azure 应用服务上的 SPA 应用程序

转载 作者:行者123 更新时间:2023-12-03 03:06:29 25 4
gpt4 key购买 nike

我已直接从 git 存储库配置将 HTML/JS SPA 部署到 Azure 应用服务。效果很好,除了,如果我从浏览器打开“/登录”,则不会重定向到“/”。相反,我看到了 404。

问题是,如果找不到页面,如何配置 IIS 显示“/index.html”,以便“显示什么?”是在客户端处理的吗?

最佳答案

根据您的描述,我建议您可以在 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>

关于asp.net - IIS Azure 应用服务上的 SPA 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44048610/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com