This article is a mirror article of machine translation, please click here to jump to the original article.

View: 30536|Reply: 1

[Source] The timeout has expired, but the connection has not yet been taken from the pool.

[Copy link]
Posted on 4/29/2019 3:50:02 PM | | | |
Unhandled exception: System.InvalidOperationException: The timeout has expired. The timeout has expired, but the connection has not yet been taken from the pool. This may be because all pool connections are in use and the maximum pool size has been reached.


This may occur because all pool connections are in use and the maximum pool size is reached.

Solution:

The first thing to do is close the connection as soon as we use it. If the connection is not closed, then the connection is saved to the connection pool and the GC is known to be destroyed. In this case, you think that the connection pool has not reached the maximum value, but in fact the connection pool has reached the maximum value, secondly, we can use the Max Pool Size = N in the connection string; to dynamically expand the maximum number of connections in the connection pool.

Illustrate:

That is, if the value of max pool size is not specified in the connectionString,Then max pool size=100If the number of visitors to the database is 101, the above error will appear if there is still no available Connection after waiting for the time set by SqlConnection.ConnectionTimeout (default is 15 seconds).

When we set to:



If the number of visitors connecting to the database at the same time is 513, the above error will occur if there is still no available Connection after waiting for the time set by SqlConnection.ConnectionTimeout (default is 15 seconds).






Previous:The HttpListener writes bytes to the stream beyond the specified Content-Length byte size
Next:Who has WeChat collection monitoring, source code + module
Posted on 4/30/2019 5:11:45 PM |
Prompt:Authors are banned or removed content is automatically blocked
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com