Search code examples
asp.nethttpwebrequestconnectiontcpwebrequest

How many concurrent outbound HttpWebRequest calls can be made in ASP.NET / IIS7?


I'm writing an ASP.NET web application which will run on Windows Server 2008 (IIS7).

Each page's codebehind will need to make at least one synchronous web service call to an external server using HttpWebRequest and GET.

My question - is there any limit to the number of outbound HttpWebRequest calls I can make? (assume that the server I'm calling has no limit)

Is there any means to pool these connections to make the app scale better? Would a web garden configuration help?


Solution

  • By default, an HTTP/1.1 server is limited to two connection, and a HTTP/1.0 server is limited to four connections. So, your ASP.NEt app will have serious throughput problems if you are trying to issue more than two outstanding requests to an HTTP/1.1 server, for eg.

    You will need to increase the connection limit, either per server, or globally.

    For eg, globally:

    ServicePointManager.DefaultConnectionLimit = 10; // allow 10 outstanding connections
    

    Hope this helps.