Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从 Global.Asax 的 Application_Startup 调用 ThreadPool.QueueUserWorkItem 是否是一个好模式。
我的意图是调用一些 Lucene 索引任务。
将线程池用于长时间运行的任务(例如 Global.asax 中的 Lucene 索引或应用程序中的任何位置)都不是一个好主意,因为这些线程也用于服务请求。它与慢请求具有相同的效果。恕我直言,最好手动生成一个新线程:
new Thread(PerformIndexing).Start();