Maxconnection failed to take effect


 


When you make calls to Web services from an ASP.NET application, you may experience contention, poor performance, and deadlocks. Clients may report that requests stop responding (or "hang") or take a very long time to execute.


One very common cause is the maxconnection parameter that the System.Net namespace uses to limit the number of connections. Generally, this limit works as expected. However, if many applications try to make many requests to a single IP address at the same time, threads may have to wait for an available connection. These threads used to have call stacks like follow:


ChildEBP RetAddr 


075be3cc 7c573c23 NTDLL!NtWaitForMultipleObjects+0xb


075be41c 79f8ead4 KERNEL32!WaitForMultipleObjectsEx+0xea


075be484 79f17522 mscorwks!WaitForMultipleObjectsEx_SO_TOLERANT+0x6f


075be4a4 79f17493 mscorwks!Thread::DoAppropriateAptStateWait+0x3c


075be528 79f1732f mscorwks!Thread::DoAppropriateWaitWorker+0x144


075be578 7a07b49c mscorwks!Thread::DoAppropriateWait+0x40


075be67c 793d424e mscorwks!WaitHandleNative::CorWaitOneNative+0x14e


075be6e0 793d4193 mscorlib_ni!System.Threading.WaitHandle.WaitOne(Int64, Boolean)+0x2e


075be6e0 7a565511 mscorlib_ni!System.Threading.WaitHandle.WaitOne(Int32, Boolean)+0x23


075be6e0 7a5ab491 System_ni!System.Net.LazyAsyncResult.WaitForCompletion(Boolean)+0x91


075be724 7a58b0b4 System_ni!System.Net.Connection.SubmitRequest(System.Net.HttpWebRequest)+0x311


075be758 7a57edc1 System_ni!System.Net.ServicePoint.SubmitRequest(System.Net.HttpWebRequest, System.String)+0x84


075be78c 7a57c982 System_ni!System.Net.HttpWebRequest.SubmitRequest(System.Net.ServicePoint)+0x221


075be7d4 0d06a5f7 System_ni!System.Net.HttpWebRequest.GetResponse()+0x30a


075be804 0d069f83 MyModule.InvokeService(System.String)+0x57


 


The default value has been changed to 12 in .Net 2.0, however this is still not enough sometimes. You may notice the maxconnetion failed to take effect even you added follow information to your web.config or even machine.config.


 


<system.net>


            <connectionManagement>


                        <add address="[ProvideIPHere]" maxconnection="96"/>


            </connectionManagement>


</system.net>


 


Why this happen? By default .Net 2.0 installs with autoConfig (in processModel) set to true, which overrides the maxconnection settings from your own configuration files.


The solution is simply set autoConfig as false in machine.config under processModel. Other parameters will still be the default values. Another blog has discussed the same symptom before, for your reference, it is:




http://blogs.msdn.com/carloc/archive/2008/03/31/maxconnection-does-not-have-effect-on-asp-net-2-0.aspx


See you next time


Zhao Wei


 

Comments (0)

Skip to main content