我们计划从 EDB PostgreSQL 迁移到社区 PostgreSQL。所以我们开始使用 NPGSQL 库而不是 EDB 库。 我们配置了与 EDB 连接字符串相同的连接字符串设置。
<add name="ConnectionString"
connectionString="Host='XXXXX';port=9999;username='XXXX';password='XXXX';Database='dev_xxxx';Timeout=300;**ConnectionLifetime=2;MinPoolSize=5;MaxPoolSize=25;**CommandTimeout=300;" />
<add name="NPGSQLConnectionString"
connectionString="Host='XXXX';port=9999;username='XXXX';password='XXXX';Database='dev_xxxx';Timeout=300;Connection Idle Lifetime=300;Connection Pruning Interval = 10;**MinPoolSize=5;MaxPoolSize=25;**CommandTimeout=300;**ConnectionLifetime=2;**" />
但是当我改用 NPGSQL 库时,我们遇到了以下问题。
Npgsql.NpgsqlException (0x80004005): The connection pool has been exhausted, either raise MaxPoolSize (currently 25) or Timeout (currently 300 seconds) ---> System.TimeoutException: The operation has timed out.
我明白,我必须增加最大池大小,但同样的配置在 EDB 中有效?
我尝试将 maxpool 大小增加到 50,但没有任何区别。所以我预计会出现连接泄漏,但无法对其进行测试或监控。
Npgsql 版本:5.0.1.1 PostgreSQL 版本:9.5