title: How to fix " A network-related or instance-specific error occurred while establishing a connection to SQL Server" error in ASP.NET
body: <p>I published my site on plesk, in login form when I enter username and password I get error. I should say that my login form is based on asp.net configuration and roles and users are set there.</p>
  
  <blockquote>
    <p>System.Data.SqlClient.SqlException (0x80131904): A network-related or
    instance-specific error occurred while establishing a connection to
    SQL Server. The server was not found or was not accessible. Verify
    that the instance name is correct and that SQL Server is configured to
    allow remote connections. (provider: SQL Network Interfaces, error: 26
    Error Locating Server/Instance Specified) </p>
    
    <p>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
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
    options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
    DbConnectionPool pool, DbConnection owningConnection,
    DbConnectionOptions userOptions) at
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool
    pool, DbConnection owningObject, DbConnectionOptions options,
    DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
    owningObject, DbConnectionOptions userOptions, DbConnectionInternal
    oldConnection) at
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
    owningObject, DbConnectionOptions userOptions, DbConnectionInternal
    oldConnection) at
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
    owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean
    allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions
    userOptions, DbConnectionInternal&amp; connection) at
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
    owningObject, TaskCompletionSource<code>1 retry, DbConnectionOptions
    userOptions, DbConnectionInternal&amp; connection) at
    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
    owningConnection, TaskCompletionSource</code>1 retry, DbConnectionOptions
    userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp;
    connection) at
    System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection
    outerConnection, DbConnectionFactory connectionFactory,
    TaskCompletionSource<code>1 retry, DbConnectionOptions userOptions) at
    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection
    outerConnection, DbConnectionFactory connectionFactory,
    TaskCompletionSource</code>1 retry, DbConnectionOptions userOptions) at
    System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource<code>1
    retry) at
    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource</code>1
    retry) at System.Data.SqlClient.SqlConnection.Open() at
    System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context,
    Boolean revertImpersonate) at
    System.Web.DataAccess.SqlConnectionHelper.GetConnection(String
    connectionString, Boolean revertImpersonation) at
    System.Web.Security.SqlRoleProvider.GetRolesForUser(String username)
    at System.Web.Security.Roles.GetRolesForUser(String username) at
    RealEstate.login.Button1_Click(Object sender, EventArgs e) in
    C:\Users\EZ-TECH\Documents\Visual Studio
    2010\Projects\3Layer\RealEstate\RealEstate\login.aspx.cs:line 36
    ClientConnectionId:00000000-0000-0000-0000-000000000000 Error
    Number:-1,State:0,Class:20</p>
  </blockquote>