Question

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

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top