Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here is the error we are getting. We moved app and db servers to x64 from 32-bit. Framework 2.0 service pack 2 is installed on the servers.

Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

share|improve this question
    
fyi, there are counters in perfmon so you can see what is going on in IIS with your connections. –  Sam Sep 24 '09 at 0:05
add comment

3 Answers

This error likely means that you're not closing your ADO.Net connections. Look through your code, make sure all of your SqlConnection objects are explicitly being properly disposed of in your ASP.Net code. You can do this with using blocks in your VB or C# code. The using construct will automatically close & dispose of your connection when it falls out of scope...

// C# example
using (var conn = new SqlConnection(myConnectString))
{
    conn.Open();

    // your data access code here
}

... or ...

' VB example
Using conn As var = New SqlConnection(myConnectString)

    conn.Open()

    ' your data access code here

End Using
share|improve this answer
    
Thanks Scott! I just went through the code and it is using the using statement to close the SqlConnection. There is only one common place where the connection gets attached to the command object. Also, this used to work on the 32 bit server without any problems. What is different on 64 bit machines? –  user21004 Sep 23 '09 at 15:13
    
There shouldn't be anything different. If I remember right - in all the cases that I've seen this error, it turned out to be an unclosed connection - and often was a "rogue" call from somewhere outside the data access layer that was only found by a "find in files" for "SqlConnection" in the solution. –  Scott Ivey Sep 23 '09 at 15:23
add comment

Are you specifying a Connect Timeout = in your connection string? If not, you may want to add this and specify 300 seconds to see if it just needs more time. I believe the default is 15 seconds.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx

share|improve this answer
    
Thanks yes, we have moved it to 30. We have also changed the connections to be 300 instead of 100 (default). Of course making connection pool size to 300 is not a good idea but that is currently making the error disappears! –  user21004 Sep 23 '09 at 19:13
add comment

My group had similar issues once we launched a pretty large Web Services integration into our production environment. We found no instances of connections not being closed so we have been forced to conclude that the connections were actually needed. I still must say that it feels against the grain to raise the connection pool's max size... In order to save some Googling, here is the exact way to change it:

<connectionStrings>
  <add name="ConnString" 
       connectionString="Data Source=IP; Initial Catalog=DBName;User ID=User;
       Password=Pass; Max Pool Size=200;" 
       providerName="System.Data.SqlClient" />
</connectionStrings>

Note the: "Max Pool Size=200;"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.