Thấy hay, lưu lại 🙂
A few years back Phil Haack wrote a great article on the dangers of recurring background tasks in ASP.NET. In it he points out a few gotchas that are SO common when folks try to do work in the background. Read it, but here’s a summary from his post.
- An unhandled exception in a thread not associated with a request will take down the process.
- If you run your site in a Web Farm, you could end up with multiple instances of your app that all attempt to run the same task at the same time.
- The AppDomain your site runs in can go down for a number of reasons and take down your background task with it.
If you think you can just write a background task yourself, it’s likely you’ll get it wrong. I’m not impugning your skills, I’m just saying it’s subtle. Plus, why should…
View original post 975 từ nữa