是否每个'的Htt prequest'都有自己的线程在ASP.NET? [英] Does every 'HttpRequest' get its own thread in ASP.NET?
问题描述
在ASP.NET中,确实每个的Htt prequest
都有自己的线程?
In ASP.NET, does every HttpRequest
get its own thread?
更新 - 为了澄清,我专门问传入的请求的
Update - To clarify, I'm asking specifically about incoming requests.
推荐答案
如果你指的是使用的Htt prequest对象从您的应用程序,从而传出请求没有 - 在当前的Htt prequest运行主题。
If you're referring to using the HttpRequest object for making outgoing requests from your application, no - HttpRequest runs in the current thread.
如果你指的是如何IIS和ASP.NET把手每个请求的线程,是的。每个请求都在一个单独的线程中运行。然而,该模型是比这稍微复杂 - 有<一个href=\"http://stackoverflow.com/questions/137400/whats-the-difference-between-a-worker-thread-and-an-i-o-thread/137431#137431\">worker线程和I / O线程来考虑。和负载下,.NET有时会移动从一个线程请求另一个作为它认为合适的。这是很重要的事情像ThreadStatic打交道时了解。
If you're referring to how IIS and ASP.NET handles threading per request, yes. Each request is run on a separate thread. However, the model is a little more complex than that - there are worker threads and I/O threads to consider. And under load, .NET will sometimes move requests from one thread to another as it sees fit. This is important to understand when dealing with things like ThreadStatic.
这篇关于是否每个'的Htt prequest'都有自己的线程在ASP.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!