2011-05-07 19 views
0

我想發表我的網站上使用的Plesk面板webhost但是當我上傳我的publushed網站,我不斷收到此錯誤:Proplem當我嘗試發佈我的網站

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) 

可以在任何一個給定我解決這個問題?!
感謝

UPDATE
我的連接字符串

 conn.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=" 
    + System.Web.HttpContext.Current.Server.MapPath(@"~\App_Data\learn.mdf") 
    + ";Integrated Security=True;User Instance=True"; 

回答

1

確保連接字符串中的web.config設置爲託管SQL Server實例,或正確的SQL Server。

+0

改爲使用.cs文件中的連接字符串!並且它在本地正常工作 – 2011-05-07 16:22:59

+0

@Israa Abd - 如果連接字符串指向本地SQL Server,則託管站點很可能無法訪問它。 – Oded 2011-05-07 16:25:27

+0

@Oded - 這是我的連接字符串(我將更新問題): conn.ConnectionString = @「Data Source =。\ SQLEXPRESS; AttachDbFilename =」 + System.Web.HttpContext.Current.Server.MapPath(@ 「〜\ App_Data \ learn.mdf」) +「; Integrated Security = True; User Instance = True」; – 2011-05-07 16:28:35

相關問題