簡體   English   中英

npgsql 連接池重復認證

[英]npgsql connection pool repeated authentication

我正在使用 Npgsql.EntityFrameworkCore.PostgreSQL 2.1.2、EfCore 2.2、asp.net 3.1。

啟用連接池(不在連接字符串中傳遞它)。 啟用日志記錄后,我得到這樣的日志:

2021-05-19 10:23:21.542 +02:00 Opening connection...
2021-05-19 10:23:21.545 +02:00 Attempting to connect to xxx.xxx.xxx.xxx:5432
2021-05-19 10:23:21.595 +02:00 Socket connected to xxx.xxx.xxx.xxx:5432
2021-05-19 10:23:21.597 +02:00 Authenticating...
2021-05-19 10:23:21.914 +02:00 A PostgreSQL type with the name hstore was not found in the database
2021-05-19 10:23:21.916 +02:00 A PostgreSQL type with the name citext was not found in the database
2021-05-19 10:23:21.918 +02:00 A PostgreSQL type with the name unknown was not found in the database
2021-05-19 10:23:21.921 +02:00 Opened connection to xxx.xxx.xxx.xxx:5432

對於執行的每個查詢,都會重復此行為。 如您所見,似乎每次執行新的身份驗證(需要 300 毫秒)。 看起來像這樣似乎連接池不起作用,因為我希望每次都重用連接。 我還嘗試添加 dbcontextpooling,結果保持不變。 有什么提示嗎?

糟糕的是,我發現每次關閉連接時,我們都會明確清空池:(

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM