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

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

Update – To clarify, I’m asking specifically about incoming requests.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x