1
votes

Getting exception suggest me on this , i don't want to increase connection timeout

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.

stacktrace:

Stack Trace 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.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe() at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.DataContext.ExecuteMethodCall(Object instance, MethodInfo methodInfo, Object[] parameters) at Tavisca.TravelNxt.Deals.DataFeeders.DataAccessLayer.HotelDealsDataClassesDataContext.spInsertAsyncHotelDealFeedRequestData(Binary hotelDealData, Nullable`1 addDate)

at Tavisca.TravelNxt.Deals.DataFeeders.Entities.AsyncHotelDealFeedRequest.Add(HotelDeal hotelDeal) at Tavisca.TravelNxt.Hotel.Plugins.DealsHandler.b__0(HotelDeal deal) at System.Collections.Generic.List1.ForEach(Action1 action) at Tavisca.TravelNxt.Hotel.Plugins.DealsHandler.UploadDeals(List`1 hotelDeals, String sessionId) at Tavisca.TravelNxt.Hotel.Plugins.DealsHandler.OnAfterProcessImplementation(CallHandlerContext context, Object[]& inputParameters, Object& response)

1

1 Answers

0
votes

You're most likely not closing your DB connections properly after you're done with them. One possibility is that you forgot to close one or more connection in few locations. Another is that you have exceptions when executing sql commands which prevent you from reaching the close statement.

Follow the following pattern to make sure that you're closing all connections properly:

SqlConnection connection = null;
try
{
    connection = new SqlConnection(...);
    //all other stuff goes here
}
catch{}
finally
{
   if(connection != null)
      connection.Close(); //This will always close the connection, even with exceptions.
}