Why am I getting the error "provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified?"

ERROR MESSAGE
 

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

RESOLUTION
 

This error is generally caused because your ASP.net application is trying to access the SQL Express database server and assumes it's located on the same server as the website. Applied Innovations does not run SQL Express on our shared hosting servers and you will need to update your SQL database connection string in your web.config file. This string looks something like this

<add name="classifiedsConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\classifiedsdb.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />

You'll want to modify this to look something like the following:

<add name="classifiedsConnection" connectionString="Data Source=[database server];Initial Catalog=[database name];User ID=[database username];Password=[database password]" />

Replacing the sections in brackets with your information. This error may also come from using the ASP.net membership provider and having the connectionString setting still set to LocalSqlServer, you'll want to update that string as well if that's the case.

Add Feedback