c#


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 works fine but after some few hours of CRUD operations it keeps throwing Under Lying Connection Close exception. Until I restart the SQL Services I am running SQL Express Edition 2012 also on development environment. 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. Like a maximum open time. 2) More often this occurs due to the tables that TCP keeps for retrying packets. TCP breaks messages into 1500 byte datagrams (data portion of packet). TCP sends an ACK for each messages sent. When a packet doesn't get ACK it will get resent usually 3-5 times at around 5 seconds a retry. 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. 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. 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. You should normally see each packet number twice (once when sent and once when ACK).

Related Links

C# Sound effect added [closed]
What is the meaning of RollingFileAppender in log4net
I was told this is bad programming practice, don't know why | Persistent Ignorance implemented wrong?
I would want to get the days of the week from a MonthCalendar
Naming of a class which is receiving raw messages and calls known interface
Access to Access Database is Denied when connecting from one pc to another in Network
RavenDb Using Linq to Select based on enum gives Incorrect auto-generated index
Binding to DataContext that is set programmaticaly
How do I cancel third party task?
XDocument write Duplicated xml
Efficient use of sockets in c#
C# do some work after all events are raised (or combine events)
How to submit changes in LinqPad
Something missing in my C# custom config implementation
C# chart, how to get the maximum x-axis value?
I want await to throw AggregateException, not just the first Exception

Categories

HOME
oauth-2.0
drupal
autohotkey
gulp
twitter-bootstrap
intellisense
android-ndk
c++builder
okhttp3
salesforce-lightning
hiveql
esxi
css-selectors
aggregation-framework
foreach
comments
webpack-dev-server
soap-client
aws-sdk-cpp
facebook-sharer
jetbrains
dompdf
ofbiz
loader
gpo
minimagick
rvm
ps
jopendocument
utc
proof-general
windows-10-mobile
csproj
cqlsh
deferred
loopback
spring-oauth2
snapkit
ports
repeat
respect-validation
matrix-multiplication
yelp
redhat-brms
pygraphviz
codepen
text-formatting
multivalue
runtime-permissions
vertex
playframework-2.3
jenkins-docker
activesupport
htop
richtext
xamarin-test-cloud
kendo-scheduler
multi-select
chain
zsh-completion
toggleclass
class-design
tinybox2
sbt-proguard
ewam
clear
ruby-1.8.7
play-json
dcg
vensim
eggplant
gcc-warning
genome
valdr-bean-validation
mri
pysvn
crystal-reports-7
drools-guvnor
formbuilder
dirname
pytz
sat4j
.net-reflector
forward-declaration
stringstream
architectural-patterns
algol
optimistic-concurrency
unordered-set
fileoutputstream
discussion-board
overlays
ffdshow
cons
stackless
scalable

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile