I'm trying to understand what the two properties ConnectionManagementElement.MaxConnection
and ServicePointManager.DefaultConnectionLimit
are used for in managing outbound connections for ASP.net applications and if a lower value in one would limit all of the outbound connections for an application.
Based on the MSDN information for the ServicePointManager the DefaultConnectionLimit
property controls the maximum concurrent connections allowed by a ServicePoint
object. It says the initial value is set to 2 unless it's running on a server then it's 10, however just a simple output of the value put's it actual running value at 2147483647. Which gets supported by the MS framework code reference in the answer to this SO post.
Based on the .Net Code the default value for ConnectionManagementElement.MaxConnection
is set to 1 per unique ip/domain + port when a values isn't defined in the web.config connection management section however based on a blog from MS when autoConfig = true
in the machine config the default value is 12 * #cores. Which in my case would be 48 = 12 * 4. There doesn't seem to be a way to get the running value for the property that the config section is setting so I'll assume for now that the value is either defined by what autoConfig determines it should be and that nothing else is overriding it.
With those details about the two properties they seem to be completely independent. However a question posted to the asp.net forum has an answer saying the configuration section setting is just an alternative way to now set the ServicePointManager.DefaultConnectionLimit
value.
Does the web/machine config ConnectionManagementElement.MaxConnection
get used when autoConfig
is set to true?
If so, does ConnectionManagementElement.MaxConnection
set the value of ServicePointManager.DefaultConnectionLimit
at Application_Start()
making synonymous to setting it as code in a defined Application_Start()
method in the global.asax?
If not, will ConnectionManagementElement.MaxConnection
and ServicePointManager.DefaultConnectionLimit
control different limit based on what initiated the network request?