是否需要在asp.net中添加最大连接池? [英] Is necessary to add max connection pool in asp .net?

查看:64
本文介绍了是否需要在asp.net中添加最大连接池?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我最大连接池数。我在web配置中注册了连接字符串。如果必须连接池最大,那么我如何添加web配置。

Hi, Please let me know about connection pooling max. I've register connection string in web config. If connection pooling max is must then how can i add in web config.

推荐答案

尝试如下:



Try is as below:

<add name="ConnName" connectionString="Server=.;database=DBName;Trusted_connection=true;pooling=true;Max Pool Size=200;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />





更新



实际上,大多数应用程序仅使用一种或几种不同的连接配置。这意味着在应用程序执行期间,将重复打开和关闭许多相同的连接。为了最小化打开连接的成本,ADO.NET使用称为连接池的优化技术。



连接池减少了连接池的次数必须打开新连接。 pooler保持物理连接的所有权。它通过为每个给定的连接配置保持一组活动连接来管理连接。每当用户在连接上调用Open时,pooler将在池中查找可用连接。如果池连接可用,则将其返回给调用者,而不是打开新连接。当应用程序在连接上调用Close时,pooler会将其返回到池化的活动连接集,而不是关闭它。一旦连接返回到池,就可以在下一次打开调用时重用它。



池连接可以显着提高性能和可扩展性您的应用程序。默认情况下,ADO.NET中启用了连接池。除非您明确禁用它,否则在您的应用程序中打开和关闭连接时,池会优化连接。



注意:默认最大池大小如果你需要,你可以在你的web.config文件中增加它。



更多信息:SqlConnection.ConnectionString Property



SQL Server连接池



UPDATE

In practice, most applications use only one or a few different configurations for connections. This means that during application execution, many identical connections will be repeatedly opened and closed. To minimize the cost of opening connections, ADO.NET uses an optimization technique called connection pooling.

Connection pooling reduces the number of times that new connections must be opened. The pooler maintains ownership of the physical connection. It manages connections by keeping alive a set of active connections for each given connection configuration. Whenever a user calls Open on a connection, the pooler looks for an available connection in the pool. If a pooled connection is available, it returns it to the caller instead of opening a new connection. When the application calls Close on the connection, the pooler returns it to the pooled set of active connections instead of closing it. Once the connection is returned to the pool, it is ready to be reused on the next Open call.

Pooling connections can significantly enhance the performance and scalability of your application. By default, connection pooling is enabled in ADO.NET. Unless you explicitly disable it, the pooler optimizes the connections as they are opened and closed in your application.

Note : default Max pool size is 100.If you need you can increase it as above on your web.config file.

For more info : SqlConnection.ConnectionString Property

SQL Server Connection Pooling


它不是必须的。最大池大小为100,默认为min为0。这些文章对你来说是必须的



ASP.NET中的连接池 [ ^ ]



SQL Server连接池(ADO.NET) [ ^ ]
Its not MUST. Max pool size is 100 and min is 0 by default. These Articles are must for you

Connection Pooling in ASP.NET[^]

SQL Server Connection Pooling (ADO.NET)[^]


这篇关于是否需要在asp.net中添加最大连接池?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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