transport-level error has occurred when receiving results from the server. error: 18 – Connection has been closed by peer
I’m getting the aforementioned exception while trying to do an
SqlDataReader sdr = command.ExecuteReader(); This is a complex (to me) program that takes a few hours to run before throwing this exception. I thought it was because there might be connections that aren’t being closed, but when I look at the database there’s only 1 active connection. And @@MAX_CONNECTIONS = 32767.
When I look at the SQL logfile it says “A new connection was rejected because the maximum number of connections on Session ID 52 has been reached.”
Any other ideas of what might be causing the problem? This is SQL Server 2008 R2, and I’m accessing the database locally via C#.Net.
One Solution collect form web for “transport-level error has occurred when receiving results from the server. error: 18 – Connection has been closed by peer”
Sure enough, I found one
SqlDataReader sdr = command.ExecuteReader(); that was not in a
using block or ever being closed. Now all is well :-). Thanks, Fred, for the help!