本文介绍了如果站点一个已关闭,则重定向到另一个站点页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Web应用程序,它的要求是这样的,如果网站由于任何原因被关闭或停止,则应重定向到另一个页面,表明该网站正在维护中

I'm developing one web application, where requirement is something like,If for any reason site is gets down or stopped, it should redirect to some another page saying site is under maintenance

任何想法我该如何实现?

Any idea how can I achieve this?

推荐答案

在某种程度上,这取决于网站停止运行或停止运行"的方式.如果www发布服务已停止,则您需要一个负载均衡器( https://f5.com/词汇表/负载均衡器),可以检测您的服务是否关闭并将流量重定向到另一台主机.请记住,对于Windows服务,您可以设置恢复选项,以便在出现故障时可以重新启动服务.

In part, this depends on how the site "gets down or stopped." If the www publishing service is stopped, then you'd need a load balancer (https://f5.com/glossary/load-balancer) that can detect if your service is down and redirect traffic to another host. Keep in mind for Windows services you are able to set Recovery options so you can restart the service upon failure.

如果网站本身在IIS中停止,则有一种方法可以将流量定向到另一个网站.在您的实时站点中,您可以为您的域添加主机标头并将其绑定到IP地址.然后,您使用相同的IP地址创建第二个站点,但没有主机头.将维护消息放在第二个站点上.进入的请求将首先到达与主机标头匹配的站点(您的活动站点),如果该站点被停止,它将在IP地址上进行匹配,从而到达您的第二个站点(您的维护站点).

In the case of the web site itself being stopped in IIS, there is a way to direct traffic to another site. In your live site, you can add a host header for your domain and bind it to the IP address. Then, you create a 2nd site using the same IP address, but with no host header. Put your maintenance message there on the 2nd site. Requests coming in will go to the site that matches the host header first (your live site), and if that site is stopped, it will match on the IP address and thereby hit your 2nd site (your maintenance site).

这篇关于如果站点一个已关闭,则重定向到另一个站点页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 07:22