简体   繁体   中英

ASP - the timeout period elapsed prior to obtaining a connection from the pool

I'm having Trouble with the following Error:

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

It seems that the error is in the following code block:

da = new SqlDataAdapter(command);
command.CommandTimeout = 100;
da.Fill(dt);
conn.Close();
return dt;

It's hard to say with such a small amount of code in your question but this error can occur when you're not disposing of your db connection objects properly. The "using" statement may help you out of this problem. There is a SO issue with the same error message and code examples here: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. which may help.

When you open any connection and not close after completion then it will show you above error. because there is app pool size limit, after limit exceeds it will show you error.

So try to close connection after completion of method. Or for the time being you can set max pool size in web.config file as 1000 or more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM