NpgsqlConnection hangs for hours on opening connection

感情迁移 提交于 2019-12-12 10:18:47

问题


I was able to successfully connect using Npgsql nuget package, until one day the program started hanging for hours on executing conn.Open() without returning. I can successfully connect with Aginity client with same parameters. I tried Firewall On and Off. I tried Antivirus On and Off. I tried Fiddler On and Off.

Some things to Note: I need to be on VPN to connect to that host. It just hangs for hours, when conn.Open() is executed. When I am not on VPN, it times out immediately. We can't see actual incoming connections to the host, just queries. But the code doesn't get to the query part, it hangs on opening connection.

using (var conn = new NpgsqlConnection(connString))
            {
                conn.Open();                                
                using (var cmd = new NpgsqlCommand(command, conn))
                ...

回答1:


It looks that in Aginity client, SSL Mode is set to Require and default value in Npgsql for SSL Mode is Disable, according to docs(https://www.npgsql.org/doc/connection-string-parameters.html). But when I am setting SSL Mode parameter of Require in connection string, I get the following exception: Npgsql.PostgresException: 42704: unrecognized configuration parameter "ssl_renegotiation_limit"

While looking online for possible solution, I found this thread created by Npgsql nuget package owner. And from what it looks like, it may be an issue, that's in a feature request state: https://forums.aws.amazon.com/thread.jspa?threadID=229990



来源:https://stackoverflow.com/questions/53218192/npgsqlconnection-hangs-for-hours-on-opening-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!