When you have a web site, for instance an installation of BlogEngine, you often want to be able to know about errors on it and if it is down. There are a lot of tools to help you out here, but in this post I will talk about using a build-in ASP.NET feature called Health Monitoring and a tool I wrote called WebMonitor.
For ASP.NET developers Health Monitoring might not be something new and something that they know much about. My guess is that the average BlogEngine user/owner doesn’t know about this, why I decided to create this post. So, what is Health Monitoring in ASP.NET?
Well, Health Monitoring is a build-in feature in ASP.NET that gives you an easy way to get notified about your applications (BlogEngine in this case) health at run-time. You can read more about Health Monitoring here on MSDN. This means that with the setup I am going to explain below, you will be able to get an email when ever an error is occurring on your site. When I say “when ever an error occurring” it is really not totally true. Health Monitoring is intelligent in the way that it doesn’t just spam you EVERY time an error occur, it wait some time and send you one email, even if 20 errors occurred with in 5 seconds. But you can read more about that on the MSDN link above.
Let me also add here, that I’m not sure if Health Monitoring is fully functional on BlogEngine, as I haven’t tested it that much on the 1.6 release. If they implemented manually redirects in code in the “wrong” way in the BlogEngine, you might not get all the error emails as you should. But let me say that I have had Health Monitoring enabled on my blog for a long time and it seems to still be working in 1.6.
So, how do we enable this? Actually it’s pretty easy. You need to open up your root web.config from your BlogEngine installation. Between the <system.web> and the </system.web> you insert the code below.
<!-- Log ALL error events -->
<add name="AllErrors" type="System.Web.Management.WebBaseErrorEvent"
startEventCode="0" endEventCode="2147483647" />
<add name="Auth Failure Audits Email" eventName="AllErrors"
provider="EmailWebEventProvider" profile="Default" minInstances="1"
maxLimit="Infinite" minInterval="00:00:05" />
Now you change the ERROR@YOURDOMAIN.COM to the email address you want the email to come from. Then you change the YOUR@EMAIL.COM to your email, where the error emails should be send.
Now your done and you should start receiving emails about errors on your site (if your STMP settings is setup correctly, you setup them up either in the web.config or on the administration pages of BlogEngine).
You can setup up a lot of stuff on Health Monitoring via the web.config, so if you want to go deeper into this, see the MSDN page linked to earlier in the post or Google it. For instance you can make the errors go to a database instead of as email and you can setup which types of error you want etc.
Another way to keep yourself updated on the “health” of your blog/site, is to use WebMonitor. WebMonitor is an application I made 2 years ago or so, as I needed to keep an eye on some servers that wasn’t responding from time to time.
So what does this "WebMonitor” tool do? Well, first of all, it’s a desktop application that you install on the machine that you are using, instead of having the server do stuff like in the Health Monitoring case. What you basically do is to setup of a “monitor” for a specific URL. The monitor will then make a request at a given time interval. You can then setup the monitor to react to different rules and notify you if something is wrong. For instance, if the response time is longer than 500 ms you can be notified with a balloon popup from the tray.
You can read more about WebMonitor and download it from Codeplex.com
Hope it helps!