Background task with asp.net web application

Is this a technique to run background work every x minutes: http://msdn.microsoft.com/en-us/library/system.threading.threadpool.queueuserworkitem%28VS.71%29.aspx

Would I upload this to global.asax?

+1
source share
3 answers

Another method is to have a page that, upon access, performs the task that you intend to do. Then you set up some kind of process (many hosting providers provide such a mechanism in their control panel) that simple hits on this page every X minutes, and this makes the task work.

0
source

No, Thread.QueueUserWorkItem is designed to poll a single work item on a thread from a thread pool. While this task is running, you are removing the thread from asp.net. The best way to accomplish your scheduled tasks is probably through the Windows service, but look at the method suggested by @Heinzi, which may be suitable for a site that does not have a huge number of concurrent users.

0
source

Source: https://habr.com/ru/post/890966/


All Articles