Showing posts with label A network-related or instance-specific error occurred while establishing a connection to SQL Server. Show all posts
Showing posts with label A network-related or instance-specific error occurred while establishing a connection to SQL Server. Show all posts

Tuesday, October 6, 2015

provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

If your facing the below issue in .NET

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)

Check the connection string in your Config file
 <connectionStrings>
        <add name="Connection" providerName="System.Data.SqlClient"  
             connectionString="Trusted_Connection=Yes;persist security info=False;Integrated Security=SSPI; Data Source=ServerName\SQLExpress;Initial Catalog=databasename" />

 </connectionStrings>

confirm that we have only one "\" in DataSource