title: Timeout period elapsed prior to obtaining a connection from the pool
body: <p>I am getting following error after hosting the application:</p>
  
  <p><b>
  Error Page    : http://********.in/Presentation Layer/NewQuotation.aspx</p>
  
  <p>Error Message : 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>
  
  <p>StackTrace    : at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource<code>1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection)
     at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource</code>1 retry, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource<code>1 retry, DbConnectionOptions userOptions)
     at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource</code>1 retry)
     at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
     at System.Data.SqlClient.SqlConnection.Open()
     at Microsoft.Practices.EnterpriseLibrary.Data.Database.GetNewOpenConnection()
     at Microsoft.Practices.EnterpriseLibrary.Data.Database.GetOpenConnection(Boolean disposeInnerConnection)
     at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command)
     at DataLayer.Quotation_DL.insertQuoteproduct(QuotationProductCombination _objQP) in F:\gayathri reddy\Enq Quote\06-01-2015\DataLayer\Quotation_DL.cs:line 430
     at BusinessLayer.Quotation_BL.insertQuoteproduct(QuotationProductCombination _objQpc) in F:\gayathri reddy\Enq Quote\06-01-2015\BusinessLayer\Quotation_BL.cs:line 88
     at EngQuote.Presentation_Layer.NewQuotation.Quotationsave(Int32 status, String oper) in F:\gayathri reddy\Enq Quote\06-01-2015\EngQuote\Presentation Layer\NewQuotation.aspx.cs:line 3711</b></p>
  
  <p>But while running the code in local Visual Studio 2010 there is no issues, when i host it in <b>server or local machine IIS or Shared hosting server</b> on that time only we are facing this issue</p>
  
  <p>I have tried  following all these steps but have not got any improvement</p>
  
  <p>1).Opened and closed the connection in every DL function</p>
  
  <p>2).Increased the command time out in this way 
                   DbCommand cmd = db.GetStoredProcCommand("Procedurename");
                  cmd.CommandTimeout = int.MaxValue;
                  SqlDataReader sdata = (SqlDataReader)db.ExecuteReader(cmd);</p>
  
  <p>3). Increased connection time out in web config</p>
  
  <p>
  
    </p>
  
  <p>4). Increased executionTimeout in web config</p>
  
  <p>
      
    </p>
  
  <p>5). Increased shutdown time out</p>
  
  <p>6). Changed debug=false</p>
  
  <p>but no use,connection time out problem still exists for long processes 
  Please suggest any solution other than above options
  Expecting a good solution for this issue from u peoples
  thanks in advance....</p>