views:

52

answers:

1

Is it a good pattern to call ThreadPool.QueueUserWorkItem from Application_Startup in Global.Asax .

My intention is to call some Lucene indexing tasks.

+3  A: 

It is not a good idea to use the thread pool for long running tasks such as Lucene indexing in Global.asax nor anywhere in your application, because these threads are also used to service requests. It would have the same effect as a slow request. IMHO it would be better to spawn a new thread manually:

new Thread(PerformIndexing).Start();
Darin Dimitrov