views:

36

answers:

2

This should be a simple question but I haven't managed to find the answer on google.

I would like to know, in terms an idiot can understand, exactly what application lifetime means in ASP.NET (and therefore when you can expect application start and end events to run).

I assumed it would be when you run and stop the app in IIS, but I've read things that suggest it's related to number of requests.

+2  A: 

By default the lifetime starts with the first request to the app. And it ends after an idle timeout.

But this is configurable based on various things (including request count) in IIS.

And IIS7.5 has the ability to start an application when IIS starts, rather than waiting for the first request.

Richard
+1  A: 

You do have to consider how the Application Pool that your site is running in is configured. Applications can be dumped in a pool with other apps or it can have its own. The pool can be restarted based on memory usage beyond a certain point, by a timer so to speak (reset daily at 3am for example) and I believe by a number of requests beyond a certain configurable number. Not a super expert on IIS so verify before you buy ;-)

Rob