如何删除超时过期和连接池问题 [英] How To remove the timeout expired and connection pooling problem

查看:89
本文介绍了如何删除超时过期和连接池问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何消除超时过期和连接池问题

How To remove the timeout expired and connection pooling problem

推荐答案

嗨 由于数据库连接未正确关闭或在数据库连接字符串中未正确设置池大小和超时期限,因此发生连接池和超时过期问题 确保您保重,数据库连接字符串的以下内容

1.如有必要,请关闭数据库连接,因为连接泄漏也会导致连接池问题
Hi Connection pooling and timeout expired problem occurs due to database connection not closed properly or poolsize and timeout period not set correctly in the database connection string
make sure you are taking care, the followings for database connection string

1. Close database connections where ever necessary, as due to connection leakages also the connection pool problem will occur
using (SqlConnection sqlConnString = new SqlConnection(ConnectionString))
{
     sqlConnection.Open();
     someCall(sqlConnString);
}



2.增加池大小,默认最大池大小为100,最小池大小为零,可以适当增加池大小

3.增加连接超时,例如连接超时= 5表示5秒

示例连接字符串供您参考



2. Increase the pool size, default maxpool size is 100 and minimum pool size is zero, you can increase pool size appropriately

3.Increase Connect timeout for ex Connect Timeout=5 means 5 seconds

Sample connection string for your reference

sqlConnString=integrated security=SSPI;SERVER=YOUR_SERVER;DATABASE=YOUR_DB_NAME;Min Pool Size=5;Max Pool Size=100;Connect Timeout=5;


这篇关于如何删除超时过期和连接池问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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