首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >从PostgreSQL9.x升级到PostgreSQL13后,Npgsql无法与PostgreSQL对话

从PostgreSQL9.x升级到PostgreSQL13后,Npgsql无法与PostgreSQL对话
EN

Stack Overflow用户
提问于 2020-12-17 01:11:38
回答 1查看 1.3K关注 0票数 1

将PostgreSQL服务器升级到版本13后,Npgsql无法再进行连接。这是一个.NET应用程序。通过命令行psql命令验证通信。我似乎不能从开发人员那里得到任何有用的错误来进一步调查。我确实让开发人员将Npgsql升级到版本5.0.1.1,但没有用。

任何关于调试的提示都将不胜感激!

代码语言:javascript
运行
复制
ERROR 2020-12-16 16:02:44,499 333535ms Archive                rieveUnlimitedData - Npgsql.NpgsqlException (0x80004005): Exception while reading from stream ---> System.TimeoutException: Timeout during reading attempt
   at Npgsql.NpgsqlConnector.<<ReadMessage>g__ReadMessageLong|194_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlDataReader.<>c__DisplayClass41_0.<<ReadMessage>g__ReadMessageSequential|0>d.MoveNext()

使用psql进行测试:

代码语言:javascript
运行
复制
C:\Program Files\PostgreSQL\13\bin>psql.exe -h XXX.XXXX.com -U postgres -d ais
Password for user postgres:
psql (13.1, server 13.0)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

ais=# \d
                 List of relations
  Schema  |       Name        |   Type   |  Owner
----------+-------------------+----------+----------
 public   | geography_columns | view     | postgres

这是我能得到的所有代码:

代码语言:javascript
运行
复制
<add name="rawDB"
     connectionString="server=host05.xxxxxx.local;port=5432;database=ais;uid=xxxxxxxxxxxx;password=xxxxxxxxxxx;timeout=30;commandtimeout=30" providerName="Npgsql"
/>
var connection = new NpgsqlConnection(ConfigurationManager.ConnectionStrings["rawDB"].ConnectionString);
connection.Open();
var cmdSel = new NpgsqlCommand(queryText, connection);
EN

回答 1

Stack Overflow用户

发布于 2020-12-19 02:25:26

commandtimeout=0解决了这个问题。我怀疑在从PostgreSQL v9.x更改为PostgreSQL v13.x之后,身份验证时间的增加(SASL交换)会导致问题的发生。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65327943

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档