The timeout period has expired. The timeout has expired before getting a connection from the pool. This may occur because all pool connections have been used and the maximum pool size has been reached.
Solutions
1. Inside the code, turn off the connection that is not closed
2. Expand the sharing pool by the following methods:
The workaround can be to modify the connection lifetime of the connection pool because the default value is 60 seconds, which is the time that the connection can be saved in the pool after it has been freed from the application.
The specific steps are as follows:
If it is ODBC, you can manually change it in the ODBC Data Source Administrator, which is located under the "Programs"-> "Start" menu, "adminstrative Tools" (Chinese Name: administrative tool), or open "ODBC data Source Administrator" from the Control Panel (Chinese name: Console), and then select the Connection pooling (connection Pooling) tab and double-click the SQL Server, select Pool connetions to this drive (use pool to connect the driver), and change the following time to a larger 60 seconds, such as 120.
If this is a SqlConnection shared connection, specify a value for the ConnectionString property connection lifetime numeric name, which by default is 0, which means that the connection will never be automatically removed from the pool. If a different value is specified, the value is compared to the creation time and the current time of the connection once the connection is returned to the pool. If the lifetime exceeds the value of the connection lifetime, the connection is removed from the pool.
The problem is that the connection to the database is not turned off, and it takes time for the system to recycle automatically. The solution is to change the size of the connection pool. Add the following code after the connection string: enlist=true; Pooling=true; Max Pool size=300; Min Pool size=0; Connection Lifetime=300;user Id=sa;packet size=1000
Packet size argument takes any integer value from 512 to 32767