ServicePointManager.DefaultConnectionLimit == 2? The Depends continues…

June 28, 2011

A few days ago I posted about the missing documentation about ServicePointManager.DefaultConnectLimit and that its default value is not always 2 (the value actually depends on the target server, if it’s a remote server or your localhost).

Yesterday, after my advanced WCF course, I got an email from one of the attendees that pointed out that indeed the default value is 2 for remote servers, but only in desktop applications (console, win forms…). In WCF services that are hosted in a web application, the default value for outgoing connections is actually 12 times the number of cores.

First of all, thanks Miron for noticing this behavior of web applications, and I’ll just want to add some more information about this setting in web environemnts:

  1. The change in the default value comes from System.Web.HttpRuntime, meaning it will be for any web hosted application, such as ASP.NET, WCF, and ASMX Web Services.
  2. The documentation in MSDN indeed mentions a changed setting with ASP.NET: “When used in the server environment (ASP.NET) DefaultConnectionLimit defaults to higher number of connections, which is 10”.
    As you can see, this documentation is also outdated…

Hope you can use this information for better configuring your desktop clients, web applications, and services (self-hosted, or IIS hosted).

kick it on DotNetKicks.com

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

one comment

  1. ShahOctober 4, 2012 ב 6:09 pm

    Hello,

    What is the default value for the DefaultConnectionLimit on the client side ? In my, case the client is a BizTalk application hosted on a 8-core machine.

    Thanks

    Reply