Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

Iam getting the following error in the C# console application which continuously runs in a server.

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

I have tried by setting sqlcmd.CommandTimeout = 120;

Please suggest a solution for this error.
Posted
Comments
crazie.coder 10-Apr-13 1:28am    
go to your management studio where you connect your sql server instance,select your instance then before click on "connect", press "option>>" button ,you'll able to see connection properties ,set "connection timeout" is "0". might be your problem will solve.
crazie.coder 10-Apr-13 1:29am    
if there is an error if max pool then please make sure you have closed connection every time after opened the same.
then let me know .
Member 8445821 10-Apr-13 1:56am    
Thanks Juhi Paunikar. I have verified whether iam closing the connections or not.It remains opened.So Now i changed to close the connections.Will check and say you whether the error still persists. Thanks once again.
crazie.coder 12-Apr-13 4:25am    
go to your management studio where you connect your sql server instance,select your instance then before click on "connect", press "option>>" button ,you'll able to see connection properties ,set "connection timeout" is "0". might be your problem will solve.have you tried that?

You need the ConnectionTimeout property of the Connection object - the CommandTimeout is something different!
 
Share this answer
 
Hello

you just add

command.CommandTimeout = 0;

happy coding


Thanks
Abhimanyu Rawat
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900