In the context of a web application, you can create background threads that run at timed intervals to mimic something like a scheduled task or windows service.
For example, say you need to run a background job that runs a particular routine (say to purge a table, etc), you can create a background thread to run every x minutes. One caveat to this approach is that when the asp.net recycles I believe the timer will be reset. This might not be a problem depending on how accurate you need your job to run at.
3. Another approach is to use a callback when a item in the cache is removed. This method basically will have your task run, but you can't really gaurantee it will run as expected as the asp.net can recycle the cache whenever it deems appropriate etc.
1 answers
In the context of a web application, you can create background threads that run at timed intervals to mimic something like a scheduled task or windows service.
For example, say you need to run a background job that runs a particular routine (say to purge a table, etc), you can create a background thread to run every x minutes. One caveat to this approach is that when the asp.net recycles I believe the timer will be reset. This might not be a problem depending on how accurate you need your job to run at.
Here are some great resources to read up on:
1. simulating a windows service
2. background threads in asp.net
3. Another approach is to use a callback when a item in the cache is removed. This method basically will have your task run, but you can't really gaurantee it will run as expected as the asp.net can recycle the cache whenever it deems appropriate etc.
reference: MSDN - CacheItemRemovedCallback
answered 2 years ago by:
400
75
Thanks Elliot, though I'm still at the start position of ASP.NET I hope, the links and your code'll help me a lot later.