有一个网站,当用户超过1000,还有被称为服务不可用消息
Service unavailable
的错误,我想显示的文字,当系统给出“Service Unavailable”错误。我该怎么做?
(app_offline.htm可以使用,但我想它的Automize)
有一个网站,当用户超过1000,还有被称为服务不可用消息
Service unavailable
的错误,我想显示的文字,当系统给出“Service Unavailable”错误。我该怎么做?
(app_offline.htm可以使用,但我想它的Automize)
如果您正在处理ASP.NET,您可以与您的自定义文本创建你自己的网页,然后配置网络。 config文件,更具体地说是customErrors标记,以便在将503 Http代码发送到客户端时再显示该文件(即再次假设IIS将503代码发送到浏览器)。
希望有所帮助。
干杯。
可能有sevaral可能的原因这个问题,
开始有一个有趣的文章关于One more reason problem that causes the 'Service Unavailable' error from IIS,这可能会让你更好理解。
谢谢huMpty – ToUpper
正如您声明您正在使用ASP.NET,您应该使用Page_Error
事件处理函数来查看陷印错误。
由于这往往是在一个项目和许多其他项目中重复代码,我使用从System.Web.UI.Page
继承并在那里填写处理程序的基类。基于MyBasePage
protected void Page_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
this.ErrorRedirect(ex, false);
}
/// <summary>
/// Redirects to a custom error page
/// </summary>
/// <param name="ex">the caught exception</param>
/// <param name="errorCaught">true if the error is handled within a try catch block, false otherwise</param>
protected void ErrorRedirect(Exception ex, bool errorCaught)
{
/* some logging code here for use by support team */
if (ex.GetType().FullName == "BusinessObjects.BrokenRulesException")
{
Response.Redirect("ContactHelpdesk.aspx");
}
if (errorCaught)
{
Response.Redirect("ContactHelpdesk.aspx");
}
else
{
Response.Redirect("Error.aspx");
}
}
在这段代码
举例而言,所有的网页时,我有与用户不匹配例如指定的规则问题进入模型数据“BusinessObjects.BrokenRulesException”都扔邮编,密码等,在这种情况下用户帮助页面弹出。
在你的情况下,你会看错误,可能会弹出错误页面。
我怎么能得到503代码来显示网页,谢谢 – ToUpper
<配置> 通过 <错误的StatusCode = “500” 重定向= “InternalError.htm”/> customErrors> configuration> –