Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 连接断了_Vb.net_Postgresql_Npgsql - Fatal编程技术网

Vb.net 连接断了

Vb.net 连接断了,vb.net,postgresql,npgsql,Vb.net,Postgresql,Npgsql,我正在使用npgsql连接器连接到PostgreSQL数据库 平均而言,每50000个查询中就有一个查询会出现以下错误。(这是在填充数据集时发生的。) 这是异常消息: The Connection is broken. 这是异常内部异常: System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remot

我正在使用npgsql连接器连接到PostgreSQL数据库

平均而言,每50000个查询中就有一个查询会出现以下错误。(这是在填充数据集时发生的。)

这是异常消息:

The Connection is broken.
这是异常内部异常:

System.IO.IOException: Unable to write data to the transport connection: An  existing connection was forcibly closed by the remote host. --->    
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BufferedStream.FlushWrite()
at Npgsql.NpgsqlQuery.WriteToStream(Stream outputStream)
at Npgsql.NpgsqlReadyState.QueryEnum(NpgsqlConnector context, NpgsqlCommand command)
at Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb)
请让我知道我是否应该在dba中发布此内容,如果是,我将重新发布


谢谢。

我对PostgreSQL不太了解,但您是否尽可能短地保持连接?只有在需要时才打开连接,然后立即关闭连接,这通常是一种很好的做法。从堆栈跟踪来看,您似乎正在使用非常旧的Npgsql(2.x)版本,请尝试升级到3.0.5。您还应该检查PostgreSQL上的日志,很可能会看到错误消息。@Daniel Gee:您是否尝试升级到3.0.5?可以吗?据我目前所知,这是由服务器引起的问题。我在服务器上设置的日志记录级别太高,因此很难判断问题出在哪里。我现在将级别设置得更低,我会让您知道我发现了什么。