我正在尝试使用plesk面板在webhost 上发布我的网站,但是当我上传我的公共网站时,我一直收到此错误:
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)
任何人都可以给我一个解决方案吗?!
感谢
更新
我的连接字符串
conn.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename="
+ System.Web.HttpContext.Current.Server.MapPath(@"~\App_Data\learn.mdf")
+ ";Integrated Security=True;User Instance=True";
答案 0 :(得分:1)
确保web.config
中的连接字符串设置为托管SQL Server实例,或者设置为正确的SQL Server。