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"/>
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.
And, whola!! every permitted client can connect remotely to the server.
I wish you success.
User contributions licensed under CC BY-SA 3.0