Freigeben über


Controlling HTTP Connection Limits

I need to make many simultaneous HTTP calls to the same service from my client application. How do I increase the limit on the number of HTTP connections?

This setting isn't available on any of the bindings or binding elements but the default limit can be set through the DefaultConnectionLimit property on System.Net.ServicePointManager. This will change the limit for every server you want to connect to. Alternatively, you can control the connection limit very granularly through configuration.

 <system.net>
<connectionManagement> 
<add address="..." maxconnection="2" /> 
</connectionManagement> 
</system.net>

The address can be for a particular HTTP address or for a plain machine name. Use the wildcard character * for the address to set the default connection limit through configuration. If a request can match against more than one of the configuration entries, then the most specific entry is the one that will be used.

Next time: Mapping Credentials to Authentication Schemes

Comments

  • Anonymous
    December 28, 2007
    There needs to be some concept of cleanup that takes place when an asynchronous request can't be completed.

  • Anonymous
    April 19, 2008
    This is a digest of WCF Security resources I was collecting for some time. Drop me a comment in case

  • Anonymous
    May 11, 2008
    This is a digest of WCF Security resources I was collecting for some time. Drop me a comment in case it is useful.