Question Exception: System.Data.SqlClient.SqlException: A transport-level

groadsvb

Well-known member
Joined
Nov 13, 2006
Messages
75
Programming Experience
Beginner
This error below occurred and my vb.net service stopped working. My sql calls to the stored procedures are in a Try Catch block but my serice still hung. Anyone know how I can keep my application from freezing when this error occurs? thanks.

Exception: System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)
 
The error occurs when the executereader is executed.
Try
Using con As SqlConnection = MyBase.GetConnection(Of System.Data.SqlClient.SqlConnection)()
If Not con Is Nothing AndAlso con.State = ConnectionState.Open Then
'Get the new Change TrackingID
Dim newChangeTracking As Int64 = 0
Using cmd As New SqlCommand("SELECT CHANGE_TRACKING_CURRENT_VERSION(), GETDATE()", con)
Using dr As New EnRoute.Common.DataLayer.SafeDataReader(cmd.ExecuteReader)
If dr.Read Then
newChangeTracking = dr(0)
_serverDateTime = dr(1)
End If
End Using
End Using
Catch ex As Exception
EnRoute.Common.Logging.Manager.GetInstance.Log(New EnRoute.Common.Logging.LogEvent("unable to update dataset " & Me.GetType.ToString(), Notification.EventTypes.Error, Notification.Severities.Medium, ex, "SynchronizedDataset", "GetUpdates"))
End Try
 
Hi,

1. can you confirm the exception is occurring ?
2. what is your call stack or dependancy tree like before and after the call to the connection ?
3. what is the timeout value on the connection property ?
4. how do you know the service is 'hung' ?

P.
 
Back
Top