ASP.Net: The Timeout period elapsed prior to obtaining a connection from the pool.

Last Reply on Oct 17, 2012 03:46 AM By Mudassar

Posted on Oct 17, 2012 03:44 AM

Hi Friends, I have one asmx web service in which it has 3 modules

ApplicationManager.vb, AgencyManager.vb and InventoryManager.vb.

ApplicationManager.vb calls the method GetAgency in AgencyManager.vb which inturn calls the functions in InventoryManager.vb

My InventoryService.asmx calls the method GetAllAgencies() in ApplicationManager.vb

so I have a sql db connection in almost every page, and in InventoryManager.vb I have 50 functions which retrives the data from db so in every function I am opening and closing the connections, this cause me some problem.

The error is shown below.

"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."

It means that all Connections are finished so I have changed the Max Pool Size to 1000 in my web.config file. but this is not a good practice,

How can I solve this that mean how can I use the single db connection for all the application?

Thanks in Advance

Ganesh

Posted on Oct 17, 2012 03:46 AM

This is because you have not closed and disposed our connection objects properly

Make sure when you open connection close it immediately.

Timeout expired. The timeout period elapsed prior to obtaining a