On 19 Jun., 16:19, rodchar <rodc...@discussions.microsoft.comwrote:
Hey all,
We get the following error on a lot of our .net application and we are not
sure why? I notice that it happens like a timeout issue like if you leave for
several minutes. Can someone please confirm this is what actuall is happening?
Exception of type 'System.Web.HttpUnhandledException' was thrown.
System.Data.SqlClient.SqlException: A transport-level error has occurred
when sending the request to the server. (provider: TCP Provider, error: 0 -
An existing connection was forcibly closed by the remote host.) at
thanks,
rodchar
Its a little difficult to say without further information, but is it
possible that you use the same connection in different methods, not
closing it when a method is done?
This would leave the connection always open, but as long as you do
something that transmits information it would never time out, when you
stop working with the application no more data is sent and the
connection would eventually time out, causing the server to close it.
In general I would suggest always opening connections when they are
needed and closing them as soon as you have received the information
you need.
Due to connection pooling the impact on performance is virtually nil,
but it keeps strange bugs like this one from occuring.
hth,
Kevin Wienhold