假設我們在一個ASP.NET應用程序的連接字符串中將Min Pool Size設置為30:
<add name="cnblogs" connectionString="Data Source=.;Initial Catalog=cnblogs;Min Pool Size=30" providerName="System.Data.SqlClient"/>
訪問一下應用程序,然後用Windows Performance Monitor監測一下.NET Data Provider for SqlServer -> NumberOfPooledConnections(連接池中的連接總數):
連接池中的連接總數不是30,而是60(見上圖)。Min Pool Size=30,為什麼NumberOfPooledConnections會是60?
用Performance Monitor監測一下.NET Data Provider for SqlServer -> NumberOfActiveConnectionPools: