Reputation: 371
I'm trying to publish my website on a webhost which using plesk panel but when I upload my publushed website I keep getting this error :
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)
Exception Details: System.Data.SqlClient.SqlException: 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)
Can any one give me a solution for this ?!
Thanks
UPDATE
my connection string
conn.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename="
+ System.Web.HttpContext.Current.Server.MapPath(@"~\App_Data\learn.mdf")
+ ";Integrated Security=True;User Instance=True";
Upvotes: 0
Views: 297
Reputation: 499302
Make sure the connection string in your web.config
is set to the hosted SQL Server instance, or to the correct SQL Server.
Upvotes: 1