0

Hi everyone,

This is the error i am getting when i try to do SqlCommand.ExecuteNonQuery(). My application runs on multiple threads and constantly opens, executes and close connection. This error i am getting after running the application for some time.

Error:
System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

Thanks,
Raymond.

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by raymondhsu09
0

Is there a chance that your SqlCommand or the corresponding SqlConnection is shared and used by multiple threads and one of them might have closed the connection (socket/handle)?

If the application uses one connection from multiple threads then, If one thread closed the connection, and another tried to use it it could generate this error.

You still need to go through the other steps - check the
logs, check the network connectivity, etc.

0

No i have checked properly each thread uses its own connection and command and they are closed and disposed after using them.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.