title: No connections available in ADO.NET connections pool
body: <p>I'm trying to figure out the cause of the increasing number of exceptions on a production environment related to the ADO.NET connections pool, I can see in the log a lot of exceptions of this kind:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>The first thing that I tried was to be sure that all connections are been closed and disposed. To do that we changed all database connections to:</p>
  
  <pre><code>try
  {
       oConnection.Open();
       //do something
  }    
  catch()
  {
  
  }
  finally
  {
       if (oConnection.State != ConnectionState.Closed)
       {
           oConnection.Close();
           oConnection.Dispose();
       }
  }
  </code></pre>
  
  <p>I'm using the following connection string:</p>
  
  <pre><code>server=databaseserver;Database=databasename;User Id=username;Password=password;Max Pool Size=600;Min Pool Size=50;Connection Timeout=180;Pooling=true
  </code></pre>
  
  <p>In Performance Manager, .NET Data Provider for SqlServer, I can see that the "NumberOfPooledConnections" and the "NumberOfActivePooledConnections" are always below the Max Pool Size of the connection string, always between 60 and 90 connections.</p>
  
  <p>Does anyone knows how can it be possible? I'm getting the exception that there's no connections on the pool, but I can see that the pool isn't full.</p>
  
  <p>My environment:</p>
  
  <ul>
  <li>Windows Server 2003 Enterprise SP2 (with all recent patchs)</li>
  <li>IIS 6.0 (with 4 worker processes in web garden and App Pool recycle every 60 minutes)</li>
  <li>SQL Server 2005</li>
  </ul>
  
  <p>May anyone help me?</p>