I've implemented a few different types of background workers running under ASP.NET but wondered what the recommended / best practice approach might be.
In a data store (in this case a mongo db) I have a queue of actions I need to process.
The queue will grow depending upon certain actions within the ASP.NET MVC app.
I want to start a background thread / worker thread that continuously processes these queued items.
Is it as simple as kicking off a background worker in the app's start event, or should it be done on a timer?
thanks in advance
sam
I use http://quartznet.sourceforge.net/index.html for job scheduling and have had great luck with it.
I think the best answer is this article from Haacked.
The Dangers of Implementing Recurring Background Tasks In ASP.NET
In summary IIS is a request driven web server. Which means if there's no one hitting your website nothing will happen. You can work around it but if you want robust background tasks the recommended approach is a Windows Service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With