Does every 'HttpRequest' get its own thread in ASP.NET?

前端 未结 1 1784
予麋鹿
予麋鹿 2020-12-30 20:18

In ASP.NET, does every HttpRequest get its own thread?

Update - To clarify, I\'m asking specifically about incoming requests.<

相关标签:
1条回答
  • 2020-12-30 20:45

    If you're referring to using the HttpRequest object for making outgoing requests from your application, no - HttpRequest runs in the current thread.

    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.

    0 讨论(0)
提交回复
热议问题