Harri Pesonen wrote:
OK, but if the whole web site is stopped in IIS, is there any way to find out
that?
What is the .NET object that represents the web site, where the current
ASP.NET application is running?
Having long-running threads within the ASP.NET application is not
recommended. If it's not too late to re-architect, could you not have
your threads in a separate process and use remoting to communicate with
them? That way, I believe, the Application_End event will fire and you
can tell the other process to shut down.
If you must keep the threads within the application, I think you'll be
looking at kludges. Most horrendous one I can think of is to
periodically perform a web request against yourself - if you don't
respond, there's a good chance you've been shut down :-D
Sorry I can't think of something more constructive here, it's not an
exact match for situations I've had in the past. I've had long-running
threads, but not even had to consider the site being stopped whilst
they're working.
Damien