Long running Clean Up task in Global.asax Application_End()

S

Stonie

Hi All,

I have an asp.net web application that needs to clean up some worker
threads on application shutdown. These threads are emptying an in
memory buffer of messages to disk.

Basically I want these threads to empty any remaining messages to disk
before exiting.

To do so, I'm calling a clean up method in Application_End()

To test the cleanup methods, I stop IIS using CMD: "IISRESET /stop"

Most of the time this works fine, the threads complete cleanup in time.
However sometimes the cleanup task takes a while to complete. In this
case IIS seems to forcefully shutdown killing the worker threads before
they can finish emptying their buffers.


So in essence I have the following questions:

1.What is the timeout IIS allows for calls to me made in
Application_End() before it forcefully exits? and is there a way to
extend this timeout?

2.Is Application_Disposed() a better place to be doing this kind of
cleanup work? And if so what is the difference in function to
Application_End()?


Any help is greatly appreciated, I fear that if this application
becomes very busy, in memory data may be lost on shutdown.

Thanks in advance.

Kind regards,
Andrew Stone.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top