We have a long running process in web application. The process runs on a seperate thread created using this:
var arguments = new object[] { startDate, endDate, m_token };
ThreadPool.QueueUserWorkItem((WaitCallback)xyzmethod, arguments);
The thread is getting terminated due to limitation of IIS on how long an unattended thread can run. It gets terminated due to session timeout or application recycle.
I want to know if a thread can notify that it is about to timeout. Or send a notification just before getting terminated?