Can I get Report Manager (2005) to email me details of any ASP.NET exceptions/errors? I have seen suggestions for modifying the Global.asax file for ASP.NET projects but none of these seem to work for me and was hoping someone here had implemented a SQL Server specific solution!
asked Aug 26 '11 at 05:17 AM in Default
If the error is logged in the ReportServer database then you could create a SQL Agent job to run every few minute and check for the error and then email you results if found.
I would suggest that you create a way of checking when the last check was executed so that you dont scan the whole database every time the job runs.
I am not sure how you would identify the error you want in particular though. I just ran
and only found a Status that indicated a failure of 'rsInternalError', there may be others that I don't have on this server though.
answered Aug 26 '11 at 05:43 AM
In the Global.asax, there is an Application_Error event which gets triggered whenever an unhandled exception bubbles up to the top without being caught by any other functions (so, on a website, that'd be a case where you get the yellow error page). If the code is trapping exceptions at a lower level and displaying text (which good code should be doing), you can't really use that event to capture an error.
For our developers' code, we log the exceptions in a database and fire off e-mails. In their code, they do this in try-catch blocks, but there's a catch-all Application_Error that looks a little bit like:
The exception chit code saves a record in a table, and then you could have a SQL Agent job run every few minutes or so to send out e-mails. ex (the exception) contains properties like Message and StackTrace, so you could put them directly into the table. The stack trace can get pretty long, though, so you may want to think about maintenance with that table if you have a lot of exceptions.
I believe you would need to be able to re-compile the code before Global.asax changes take effect. I haven't messed with the Report Manager code, so I don't even know if you can compile it yourself.