11

I reinstalled my main work pc, but didn't reinstall visual studio after 5 months. Now i did and started my old project, and now it doesn't run.

I get a timeout error when connecting to SQL Server, so i increased the timeout in the connectionstring and now i get the error:

[Win32Exception (0x80004005): The specified network name is no longer available]

[SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)]
   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) +1004
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +798
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +722
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +449
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +108
   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +935
   System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +143
   System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +17
   System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +139
   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +367
   System.Data.SqlClient.SqlConnection.Open() +130
   RRHHComprobantePago.comprobante_pago.Page_Load(Object sender, EventArgs e) in c:\Users\fleon\Documents\Visual Studio 2015\WebSites\RRHHComprobantePago\comprobante_pago.aspx.cs:47
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +85
   System.Web.UI.Control.OnLoad(EventArgs e) +79
   System.Web.UI.Control.LoadRecursive() +130
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2832

On other searches, i saw people that said just to restart visual studio and recompile. I did that, even rebooted, same error.

I can use Management Studio to connect to the database and run queries, so i don't think the issue is in the database server itself. Maybe some kind of firewall?

For reference, the error appears just when doing sqlConn.Open(), so there is no query running. Also, here is my connection string:

<add name="adamConnectionString" providerName="System.Data.SqlClient" connectionString="Initial Catalog=adam;Data Source=192.168.xxx.xxx;uid=user;pwd=password;Integrated Security=false;Connection Timeout=3000000"/>
fjleon
  • 341
  • 1
  • 3
  • 10
  • Check the SQL Configuration Manager to see if TCP/IP connections are allowed (and any other protocols that your application may be using) – Syntax Error Jun 29 '16 at 13:46
  • @JayF1 it is allowed. I can connect to the server properly through SSMS. – fjleon Jun 29 '16 at 19:09
  • 1
    @stuartd of course. i tried first by dns name, then by straight ip. this project used to work before i formatted my machine (had win 8.1, now 10) – fjleon Jun 29 '16 at 19:09
  • the Data Source ( Data Source=192.168.xxx.xxx) of your connection string might be the problem. – Ola_leke Apr 01 '22 at 21:54

2 Answers2

1

It is due to the network connection getting lost intermittently. No network name found error.

0

In my opinion, 98% sure, because I recently had the same experience, it is a network issue from the server provider.

for instance: if you are rent the server from Ionos, by default all remote connections are blocked, even though you disable the firewall in the server. you still won't be able to connect remotely. You can, however, do your work on the server without any problem.

To connect remotely, you have to contact the Server provider. They will explain how to enable firewall ports from your control panel.

I contacted my server provider as I almost get frustrated. here was their response.

Valid XHTML

And, whola!! every permitted client can connect remotely to the server.

I wish you success.

Ola_leke
  • 61
  • 1
  • 6