SQLConnection池大小和C#中的活动连接数 [英] SQLConnection pool size and active connection count in C#

查看:211
本文介绍了SQLConnection池大小和C#中的活动连接数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#中,可以通过在连接字符串中使用 Pooling = True和 Max Pool Size = XY来启用/禁用连接池。

In C# it is possible to enable/disable Connection Pooling by using "Pooling=True" and "Max Pool Size=XY" in connection string.

例如: 什么是最大允许值最大池大小在sql连接字符串中

是否可以问到与SQL Server处于活动状态的连接数以及当前程序池的大小是多少?

Is it possible to ask how many connections to SQL server is active and what is the current pool size programmatically?

推荐答案

您可以使用 NumberOfActiveConnections NumberOfPooledConnections ADO.NET性能计数器:

You can use NumberOfActiveConnections or NumberOfPooledConnections ADO.NET performance counter:

https ://docs.microsoft.com/zh-cn/dotnet/framework/data/adonet/performance-counters

这篇关于SQLConnection池大小和C#中的活动连接数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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