0

I have a simple application that fetches entries from a few databases and then uses selenium to open a chrome window and paste information in a form. This agent runs once every five minutes.

I've looked through the logs and this error comes up now and then. When trying to find information about this problem the only "fixes" I can find is related to firewalls blocking ports or other issues that should be "persistent" like DB's not existing anymore / changed names or credentials.

The problem with my situation is that this error only happen on once or twice on some days, other days it never happens. If this was a problem with ports / DB names I would think this error should happen every time the agent runs. The agent runs 288 times a day, and like I mentioned, this only happens very few times in regards to the total runs of the agent.

I've come across an answer that suggests that this could be related to network issues on the host for the agent.

I would appreciate any ideas of what could cause this issue.

System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The specified network name is no longer available.) ---> System.ComponentModel.Win32Exception (0x80004005): The specified network name is no longer available at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager) at …

2
  • 1
    "The specified network name is no longer available" does indeed suggest a network connectivity issue. If this is a problem, you can add retry logic to your code.
    – stuartd
    Mar 19, 2019 at 10:41
  • You are probably using a Password Server to verify credentials when a connect is established.It looks like the Server isn't responding quick enough.I would check the Event Viewer on SQL Server to see if there are any errors.Also check the SQL Server Log files for additional information.Also check you connection string and make sure your do NOT attach to the MDF file. The attach statement is not needed. The database is already attached to the server and the server knows the location of the MDF file.
    – jdweng
    Mar 19, 2019 at 11:20

1 Answer 1

0

I think the reason can be found here

" the application is taking the assumption that the SQL connection is always available (no check or test before running commands) so when the line goes down or anything makes the connection drop/close the application produces that message.

To reproduce, simply kill the SQL session on the SQL server and you will get that very same a similar message."

Fix would be to add a check to make sure the connection can be made and add a retry / delay + retry

1
  • You got bigger problems if you have implement retry/delay/retry logic with a Sql Server Connection. That connection should be rock solid or go home.
    – mxmissile
    Mar 19, 2019 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.