tags:

views:

52

answers:

3

I want to run some basic checks when my ASP.NET server goes up. Mostly simple things like does the db exist, am i missing any bins, etc. What function do i use to call my code?

+1  A: 

I wouldn't waste my time on any of these things. Are they likely to be problems more than once a year or less? Instead, I'd just make sure my code gave good exception messages when or if these problems arise.

John Saunders
What if he's building an ASP.Net application he wants to sell?
Spencer Ruport
Then I wouldn't waste my time on these. I'd make sure my installer installed everything; I'd make sure it had a Repair feature; I might separately package the Installation Verification step called in the installer so it could be run as a diagnostic; and I'd make sure to produce excellent exception messages and other diagnostics.
John Saunders
What if i want to find the problem ASAP instead of eventually ;)
acidzombie24
Then you could periodically run the Installation Verification Procedure as I suggested. I would be interested to know under what circumstances that ever fails after the first good install. I bet it never does, absent some idiot who deletes the bin directory. You need good runtime exception logging, messages, etc. in any case.
John Saunders
There is no installer ATM, i am basically passing this around to a few guys (typically w/o source). There is only a few lines added. Exceptions work but then the users would have to do stuff before its thown.
acidzombie24
I don't think we're understanding each other, and I thought you were talking a production site. Please edit your question to clarify what you're trying to accomplish, what kind of users, how distributed, what version of ASP.NET and Windows, etc.
John Saunders
+5  A: 

You must use the application_start event on Global.asax

tekBlues
A: 

I suggest you read ASP.NET Application Life Cycle Overview for IIS 7.0 on MSDN.

Assaf Lavie