异常 - 达到最大池大小 [英] Exception-Maximum pool size was reached

查看:56
本文介绍了异常 - 达到最大池大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理以下异常?

超时已过期。从池中获取连接之前已经过了超时时间。这可能是因为所有池连接都在使用中而且最大池已达到大小。

How can i handle the following exception?
"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".

推荐答案

将数据连接放入使用块以确保连接完成后关闭。



Put you data connection in using block to make sure connection is closed after completion.

using (SqlConnection cn = new SqlConnection("Connection String")
{

}


这篇关于异常 - 达到最大池大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆