对于HTTP错误503自定义错误页 [英] Custom Error Page for Http Error 503

查看:919
本文介绍了对于HTTP错误503自定义错误页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要发送自定义错误页由我的asp.net网站产生的503错误。我试图模拟通过关闭应用程序池(不工作),并淹没我的请求的应用程序的条件。虽然IIS向我发送默认503错误页面,即使我已经尝试设置自定义URL在IIS和AS​​P.NET此错误code,它仍然返回我默认的503错误页面!

I need to send a Customized Error page for 503 Errors produced by my asp.net website. I have tried to simulate the condition by switching off the application pool (doesn't work) and by flooding my application with requests. Even though IIS sends me the default 503 error page, and even though I have tried setting a Custom URL in IIS and ASP.NET for this error code, it still returns me the default 503 error page !

我想AP preciate如果有人也可以告诉我在哪里默认的503错误页面留了IIS发送。

I'd appreciate if someone could also tell me where the default 503 error page is kept that IIS sends.

推荐答案

遇到同样的问题,但我只是设法让这个在.NET应用程序使用的是传统的ASP页面控股为我们工作的(我不知道这是否会工作同一个apsx):

Ran into the same problems, but I've just managed to get this working for us using a Classic ASP holding page in a .NET application (I'm not sure if it'll work the same for an apsx):


  1. 确认经典ASP在IIS中启用。值得一读:<一href=\"http://blogs.iis.net/bills/archive/2007/05/21/tips-for-classic-asp-developers-on-iis7.aspx\">http://blogs.iis.net/bills/archive/2007/05/21/tips-for-classic-asp-developers-on-iis7.aspx

创建一个名为 Offline.asp 传统的ASP文件,并包含以下内容放置在您的网站的根目录:

Create a classic ASP file called Offline.asp and place it in the root of your website with the following contents:

<%

Response.Status = "503 Service Unavailable"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <meta name="robots" content="noindex,nofollow" />
        <title>Sorry, we're down for essential maintenance</title>
    </head>
    <body><h1>Sorry, we're down for essential maintenance</h1></body>
</html>


  • 现在在IIS7管理器中去的错误页面管理部分,添加自定义错误页,像这样:

  • Now in IIS7 Manager go the Error Pages administration section, add a Custom Error Page like so:

    现在,每当IIS接收到503,它将Offline.asp的内容发送到浏览器,以及503 code(让搜索引擎不要是重要 ŧ列出你的错误页面!)

    Now whenever IIS receives a 503, it will send the contents of the Offline.asp to the browser, as well as the 503 code (which is important so that Search Engines don't list your error page!)

    现在,如果你想你可以建立一个简单的重定向规则的一切重定向到Offline.asp把你的应用程序脱机。

    Now if you want to take your application offline you can just set up a simple redirect rule to redirect everything to Offline.asp.

    这篇关于对于HTTP错误503自定义错误页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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