Reputation: 1667
I do have a quick question regarding extra foreground threads that are running in an ASP.net Web Application. I let some things run in an extra Thread class thread like Cleanup-Actions after a certain event, but the user is not interested in those operations, therefore the threads - these operations should just run ( rather in the background ) and have nothing to do with serving requests.
What happens when the application crashes, because of an uncaught exception - will the extra thread run to completion or does IIS cancel it immediately ?
What does happen when the application pool recycles ?
I know that it would be a better approach by using separate programms for jobs like this.. Windows Service for example, but I "inherited" that code by former employees..
Upvotes: 3
Views: 148
Reputation: 171178
Any work being done or queued inside ASP.NET can be lost at any time. It is not necessary to answer your questions in detail because they are moot. There are many reasons the whole process can just go away.
Windows Services also can go away at any time (crash, blue screen, ...).
If you need reliable execution you need to persist the work. Some kind of message queue (could be a database table) is appropriate.
Upvotes: 1