title: Unable to connect to SQL Server session database
body: <p>My asp.net applications works fine everyday.
  Until last month, my web start to get 2-3 time of problem with Sqlsession state server as 
  follow:</p>
  
  <blockquote>
    <p>Blockquote
    System.Web.HttpException  Exception of type 'System.Web.HttpException' was thrown.     at System.Web.HttpAsyncResult.End()     at System.Web.SessionState.SessionStateModule.EndAcquireState(IAsyncResult ar)     at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)  ==================================================  Exception: System.Web.HttpException  Unable to connect to SQL Server session database.     at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e)     at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo)     at System.Web.SessionState.SqlSessionStateStore.GetConnection(String id, Boolean&amp; usePooling)     at System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean&amp; locked, TimeSpan&amp; lockAge, Object&amp; lockId, SessionStateActions&amp; actionFlags)     at System.Web.SessionState.SqlSessionStateStore.GetItemExclusive(HttpContext context, String id, Boolean&amp; locked, TimeSpan&amp; lockAge, Object&amp; lockId, SessionStateActions&amp; actionFlags)     at System.Web.SessionState.SessionStateModule.GetSessionStateItem()     at System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state)  ==================================================  Exception: System.InvalidOperationException  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.     at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)     at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)     at System.Data.SqlClient.SqlConnection.Open()     at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo)  </p>
  </blockquote>
  
  <p>Then I started to look into my session db server and did "exec sp_who" in my sql client that found a lot of records of AspState operation in result.</p>
  
  <p>I don't know what causes this kind of problem because we do changed no serious things
  in out application, just a few bug fixed.</p>
  
  <p>Here is the detail of my web applications's environments:</p>
  
  <p>asp.net 3.5 (convert from 1.1) ... work very well in
  2 servers farm with sqlmode of session state.</p>
  
  <p>Does anyone kwow about this problem or get any idea for investigation?
  Thanks</p>