数据库的HTTP状态代码已关闭 [英] HTTP Status Code for database is down

查看:65
本文介绍了数据库的HTTP状态代码已关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一个页面,报告该网站的运行状况并设置HTTP 200状态代码,一切正常.外部监视程序使用此页面来检查站点是否正常运行.

I have a page on my web site that reports on the health of the site and sets an HTTP 200 status code is everything is okay. This page is used by an external monitoring program to check that the site is up.

点击该页面后,我将进行非常轻量级的数据库proc调用,以查看数据库是否正常运行.如果失败,我想向监视器返回一个有意义的HTTP错误代码,以通知它一切都不正常.

When this page is hit, I make a very lightweight DB proc call to see if the DB is up and okay. If this fails, I want to return a meaningful HTTP error code to the monitor to let it know that all is not well.

据我所知,没有HTTP状态显示我依赖的第三方组件已关闭",那么在这种情况下您将返回什么?

From what I can work out there's no HTTP status that says "a third party component that I rely on is down" so what what would you return in this case?

503服务不可用...?

503 Service Unavailable...?

推荐答案

我怀疑500或503是合适的. 503通常用于过载或维护条件,但我认为将其用于您的情况并非没有道理.

I would suspect that a 500 or 503 would be appropriate. 503 is generally used for overloaded or maintenance conditions, but I don't think it would be unreasonable to use it for your situation.

这篇关于数据库的HTTP状态代码已关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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