显示"504网关超时错误"的自定义错误; [英] Show custom error for "504 Gateway Timeout error"

查看:273
本文介绍了显示"504网关超时错误"的自定义错误;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为ASP.net MVC-5项目工作,我是一个初学者.到目前为止,我已经了解MVC的基础知识,并且能够显示页面,进行发布和获取请求.但是我遇到一个问题,我会收到"504网关超时错误",并且我需要实现一个功能,如果客户端遇到"504网关超时错误",我应该能够显示一个特定的页面,例如出问题了"而不是标准错误.下面是我的工作.

I am working to ASP.net MVC-5 project and I am a beginner. As of now I know the basics of MVC and able to display pages and make post and get request. But I am stuck with one issue where I get "504 gateway time out error" and I need to implement one functionality where if the client gets `504 gateway timeout error" I should be able to show a particular page like "Something is wrong" instead of standard error. To start with below is what I did.

  <system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5" />
    <customErrors mode="On" redirectMode="ResponseRewrite">
    </customErrors>
  </system.web>

但是我还需要更改或添加什么.有人可以在这里引导我.我迷路了.

But what else I need to change or add. Can someone guide me here. I am lost.

推荐答案

如果您的ASP.NET MVC应用程序由IIS(或其他代理服务器)托管,则IIS将返回504错误并将其发送到浏览器,因为您的应用程序未及时响应请求. IIS有一个超时(可为每个网站配置),如果超时,则返回504.

If your ASP.NET MVC application is hosted by the IIS (or another proxy server), then the 504 error is returned by the IIS and sent to the browser, because your application does not respond to the request in a timely manner. The IIS has got a timeout (configurable for each web site) and if this is reached, then 504 is returned.

在这种情况下,您无法在应用程序内定义自定义错误页面,因为它没有反应.

In this scenario you cannot define a custom error page inside your application, because it is not reacting.

您可以将IIS配置为服务器自定义错误页面.此视频教程显示了如何执行此操作.

You can configure the IIS to server custom error pages. This video tutorial shows how to do this.

这篇关于显示"504网关超时错误"的自定义错误;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆