如何替换默认的Azure 403错误页面

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

我有一个ASP.NET MVC部署到Azure,用户通过使用客户端证书登录。在本地,如果用户未发送证书或证书无效,则网站会将用户重定向到/ error / 403端点。但是在Azure上这不起作用:用户没有重定向到/ error / 403,显示的页面总是这样:enter image description here

这是我在<system.webServer>节点内的Web.Config代码:

<httpErrors errorMode="Custom" existingResponse="Replace">
  <clear />
  <error statusCode="400" path="/error/400" responseMode="Redirect" />
  <error statusCode="404" path="/error/404" responseMode="Redirect" />
  <error statusCode="500" path="/error/500" responseMode="Redirect" />
  <error statusCode="501" path="/error/501" responseMode="Redirect" />
  <error statusCode="503" path="/error/503" responseMode="Redirect" />
</httpErrors>-->

我还尝试使用<httpErrors existingResponse="PassThrough" />节点添加system.webServer或将我的代码从system.web移动到customErrors,但似乎用户在web.config被读取之前被阻止。对于我尝试过的每一项改变,行为都是一样的。

我怎么解决?谢谢

asp.net azure web-config certificate
2个回答
1
投票

不幸的是,Azure目前还不支持此功能。 App Service Team的反馈是最近在这个post。但是,有一种方法可以通过这个post来讨论部署插槽。


0
投票

看起来您的网站没有运行。

Azure网站停止有三种可能的原因:

  • 它已达到结算限制,您的网站已被停用。
  • 它已在门户网站中停止。
  • 它已达到适用于免费或共享比例模式的资源配额限制。

有关上述任何条件,请检查Azure门户。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.