最近,一个项目出现了我的需求...... 1.构建一个持续检查网站可用性的C#控制台应用程序。 2.在某处保存网站状态,以便不同的平台可以访问该状态。
控制台应用程序已完成,但我正在努力保存状态。 我在想一个SQL记录。
您将如何处理保存状态的位置,以便它可扩展,灵活并可用于x个框架或平台?
更新:看起来我使用RESTful服务使用数据库存储。 我还将状态保存为xml文件,作为服务停机的后备。
Recently, a project came my way with requirements to ... 1. Build a C# console app that continuously checks website availability. 2. Save website status somewhere so that different platforms can access the status.
The console app is completed but I'm wrestling with where I should save the status. I'm thinking a SQL record.
How would you handle where you save the status so that it's extensible, flexible and available for x number of frameworks or platforms?
UPDATE: Looks like I go with DB storage with a RESTful service. I also save the status to an xml file as a fallback to service being down.
最满意答案
可以将网站的可用性发布到第二个Web 服务 ,该服务返回关于所述网站的可用性的JSON / Xml结果。 这几乎意味着任何能够进行Web服务调用的平台/语言都可以检查网站的可用性。
不可否认,这确实给出了单点故障(状态Web服务),但不可避免地,除非您想要开始具有故障转移Web服务等,否则您最终将会遇到这种情况。
The availability of the web-sites could be POSTed to a second web service which returned a JSON/Xml result on the availability of said website(s). This pretty much means any platform/language that is capable of making a web-service call can check the availability of the web site(s).
Admittedly, this does give a single point of failure (the status web service), but inevitably you'll end up with that kind of thing anyway unless you want to start having fail-over web services, etc.
更多推荐
发布评论