最近几天,我们经常在网站上看到这样的错误信息:
“超时过期。超时时间
在获取
来自池的连接。这可能
已经发生是因为全部池化了吗
连接正在使用,马克斯泳池
规模达到了。”
我们已经有一段时间没有更改代码中的任何内容了。我修改了代码以检查未关闭的打开连接,但发现一切正常。
我怎么解决这个问题?
我需要编辑这个池吗?
如何编辑此池的最大连接数?
高流量网站的推荐值是多少?
更新:
我需要在IIS中编辑一些东西吗?
更新:
我发现活动连接的数量在15到31之间,我发现在SQL server中配置的最大允许连接数超过3200个连接,是31太多了还是我应该在ASP中编辑一些东西。网络配置?
您已经泄漏了代码上的连接。您可以尝试使用using来证明您正在关闭它们。
using (SqlConnection sqlconnection1 = new SqlConnection(“Server=.\\SQLEXPRESS ;Integrated security=sspi;connection timeout=5”))
{
sqlconnection1.Open();
SqlCommand sqlcommand1 = sqlconnection1.CreateCommand();
sqlcommand1.CommandText = “raiserror (‘This is a fake exception’, 17,1)”;
sqlcommand1.ExecuteNonQuery(); //this throws a SqlException every time it is called.
sqlconnection1.Close(); //Still never gets called.
} // Here sqlconnection1.Dispose is _guaranteed_
https://blogs.msdn.microsoft.com/angelsb/2004/08/25/connection-pooling-and-the-timeout-expired-exception-faq/