[Mono-aspnet-list] HttpWebRequest Allocates Multiple Threads per Request

Robert Jordan robertj at gmx.net
Mon Jan 21 17:39:05 UTC 2013


On 21.01.2013 17:11, Sean Reque wrote:
> I noticed today in a debugger session that  performing a simple POST
> request with HttpWebRequest  allocates three new threads. Examining the
> source code reveals that the synchronous methods GetRequestStream() and
> GetResponseStream() use the asynchronous versions of themselves underneath
> the hood.
> Allocating three threads per request is unacceptable for my application.
> Is there any way to work around this so that making synchronous requests
> does not allocate new threads?

The threads you're seeing belong to the thread & I/O pools. They
are allocated once and then reused. There is no way to disable
this behavior.

Robert





More information about the Mono-aspnet-list mailing list