BackgroundWorker thread in ASP.NET

后端 未结 7 1964
日久生厌
日久生厌 2020-11-27 17:50

Is it possible to use BackGroundWorker thread in ASP.NET 2.0 for the following scenario, so that the user at the browser\'s end does not have to wait for long time?

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 18:16

    What you need to use for this scenario is Asynchronous Pages, a feature that was added in ASP.NET 2.0

    Asynchronous pages offer a neat solution to the problems caused by I/O-bound requests. Page processing begins on a thread-pool thread, but that thread is returned to the thread pool once an asynchronous I/O operation begins in response to a signal from ASP.NET. When the operation completes, ASP.NET grabs another thread from the thread pool and finishes processing the request. Scalability increases because thread-pool threads are used more efficiently. Threads that would otherwise be stuck waiting for I/O to complete can now be used to service other requests. The direct beneficiaries are requests that don't perform lengthy I/O operations and can therefore get in and out of the pipeline quickly. Long waits to get into the pipeline have a disproportionately negative impact on the performance of such requests.

    http://msdn.microsoft.com/en-us/magazine/cc163725.aspx

提交回复
热议问题