开发者

Determining programmatically whether an ASP.NET/C# Website is down

开发者 https://www.devze.com 2023-01-14 12:15 出处:网络
I am having an ASP.NET/C# Web application hosted in IIS6. My requirement is to send a mail whenever the Websit开发者_如何转开发e is down without using any third party tool. How can I accomplish this j

I am having an ASP.NET/C# Web application hosted in IIS6. My requirement is to send a mail whenever the Websit开发者_如何转开发e is down without using any third party tool. How can I accomplish this job programmatically (of course using C#)?

Thanks in advance!!!!!


You will need a PC that is as independent as possible form the WebServer. Ideally on the other side of the world.

Then run a little program with a Timer and check every X minutes. Do a simple grab with WebClient. If it fails, send the mail.

For improved reliability, run more instances of the monitoring program at different locations.


Define "down". There are many reasons why a website might not be accessible or only partially working. Ultimately, it's really what the end user is seeing that's most important. A tool that is running outside of the website's network infrastructure that periodically queries the website's key pages and checks important factors such as the HTTP status code, the response time, the size of the page and even possibly checks that important chunks of HTML are present would achieve this.

Attempting to determine why the site is not responsing is an even more complex task that would involve checking for the presence of the IIS application pool, etc.

This is not a trivial tool to create so I would recommend using an off-the shelf solution if possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消