我应该在数据库连接字符串中设置最大池大小吗?如果我不这样做会怎样?
这是我的数据库连接字符串。直到现在我才设置最大池大小。
public static string srConnectionString =
"server=localhost;database=mydb;uid=sa;pwd=mypw;";
那么目前我的应用程序支持多少个连接?增加连接池大小的正确语法是什么?
该应用程序是用 C# 4.0 编写的。
This is my database connection string. I did not set max pool size until now.
public static string srConnectionString =
"server=localhost;database=mydb;uid=sa;pwd=mypw;";
So currently how many connections does my application support? What is the correct syntax for increasing the connection pool size?
The application is written in C# 4.0.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
目前您的应用程序支持池中 100 个连接。如果您想将其增加到 200,conn 字符串将如下所示:
您可以通过在数据库中执行
sp_who
过程来调查您的应用程序使用了多少个数据库连接。在大多数情况下,默认连接池大小就足够了。Currently your application support 100 connections in pool. Here is what conn string will look like if you want to increase it to 200:
You can investigate how many connections with database your application use, by executing
sp_who
procedure in your database. In most cases default connection pool size will be enough.“目前是的,但我认为这可能会在高峰时刻引起问题”
我可以确认,我遇到了由于高峰请求而超时的问题。设置最大池大小后,应用程序运行没有任何问题。
IIS 7.5 / ASP.NET
"currently yes but i think it might cause problems at peak moments"
I can confirm, that I had a problem where I got timeouts because of peak requests. After I set the max pool size, the application ran without any problems.
IIS 7.5 / ASP.Net
我们可以通过以下方式定义最大池大小:
We can define maximum pool size in following way: