简体   繁体   English

一段时间后底层连接失败

[英]Underlying Connection Failed after some time

We have a WPF application which communicates through REST API hosted on Production Environment running SQL Server 2012 . 我们有一个WPF application ,该WPF application通过运行SQL Server 2012生产环境上托管的REST API进行通信。 WPF application works fine but after some few hours of CRUD operations it keeps throwing Under Lying Connection Close exception. WPF应用程序可以正常工作,但是经过数小时的CRUD操作后,它始终抛出Under Lying Connection Close exception. Until I restart the SQL Services I am running SQL Express Edition 2012 also on development environment. 在重新启动SQL Services之前,我还将在开发环境上运行SQL Express Edition 2012 But it works fine on development environment. 但是它在开发环境上工作良好。

There are a few reasons this could occurr 1) Server or router has settings that are closing the TCP connection. 原因可能有几种:1)服务器或路由器的设置正在关闭TCP连接。 Like a maximum open time. 就像最大的开放时间。 2) More often this occurs due to the tables that TCP keeps for retrying packets. 2)这种情况经常发生是由于TCP保留了用于重试数据包的表。 TCP breaks messages into 1500 byte datagrams (data portion of packet). TCP将消息分解为1500字节数据报(数据包的数据部分)。 TCP sends an ACK for each messages sent. TCP为发送的每个消息发送一个ACK。 When a packet doesn't get ACK it will get resent usually 3-5 times at around 5 seconds a retry. 当数据包没有收到ACK时,通常会在重试5秒钟左右重发3-5次。 Packets also can be receive in random order. 数据包也可以按随机顺序接收。 So the sending side of TCP must keep each packet in a table until an ACK is received. 因此,TCP的发送端必须将每个数据包保存在表中,直到收到ACK。 Then remove packet from table. 然后从表中删除数据包。 The receiver must have table to reorder packets. 接收者必须具有用于重新排序数据包的表。 Packets are removed from table when all previous packets are received. 收到所有先前的数据包后,将从表中删除数据包。 These tables can get very large and then the operating system will probably close application. 这些表可能会变得非常大,然后操作系统可能会关闭应用程序。 Normally what causes this to happen is when the receiving end is running a lot of applications it doesn't ACK a message in 5 seconds. 通常,导致这种情况发生的原因是,当接收端正在运行许多应用程序时,它不会在5秒钟内确认消息。 So the Sending end re-sends packets. 因此,发送端重新发送数据包。 The resend packets sends more data which adds more processing to the receiver slowing the receiver even more. 重发数据包发送更多的数据,这给接收器增加了更多的处理,从而使接收器更加缓慢。 The best way of checking for issue is to use a sniffer like wireshark or fiddler and see if you see duplicate packet numbers which indicates a retry. 检查问题的最佳方法是使用嗅探器,例如Wireshark或Fiddler,查看是否看到重复的数据包编号,表示重试。 You should normally see each packet number twice (once when sent and once when ACK). 通常,您应该看到每个数据包号两次(发送一次,确认一次)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TransactionScope完成后,基础连接无法打开 - Underlying connection failed to open after TransactionScope Complete 一段时间后重新尝试连接服务器 - Re attempt server connection after some time MVC连接错误:基础提供程序在打开时失败 - MVC Connection Error : The underlying provider failed on Open 基础提供程序在实体框架中打开时失败 - The underlying provider failed on Open in entity framework connection 提供基础连接的事务范围无法打开 - Transaction Scope giving underlying connection failed to open 使用SignalR Hubs,连接会在一段时间后丢失 - 为什么? - Using SignalR Hubs, connection is lost after some time - why? 与StackExchange.Redis闲置一段时间后出现连接问题 - Connection issue after some idle time with StackExchange.Redis 连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立连接失败 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed 一段时间后,EF 在表中插入值失败 - EF inserting values in table failed after some time 当Unity解决依赖关系时,基础提供程序在Open上失败 - The underlying provider failed on Open at the time Unity resolve the dependencies
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM