2013-11-22 45 views
0

我在嘗試將我的網站連接到Aruba服務器上的MySql失敗。Web.config aruba ConnectionString

我總是得到這樣的錯誤:

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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

我使用這個連接字符串現在:

<add name="OfferteConnectionString1" connectionString="Data Source=example.org;User ID=xxxx;password=yyyy" providerName="System.Data.SqlClient"/> 

我也試過這樣:

<add name="OfferteConnectionString1" connectionString="Server=example.org;Database=Sql702732_1;Uid=xxxx;Pwd=yyyy;" providerName="System.Data.SqlClient"/> 
+0

Daniele,你應該在控制面板中的DB區/頁面中的某處獲取連接字符串。只需將其複製到代碼中即可使用。而且,正如錯誤所述,數據庫是否配置爲允許遠程連接?通常這是在創建數據庫時完成的。最後但並非不那麼重要,如果您多次嘗試訪問數據庫失敗,他們可能已禁止您的IP地址。執行上述檢查並重試。 – FeliceM

+0

問題是我無法在mysql控制面板中找到此部分。我變得瘋了,我不明白> _> – ProtoTyPus

+0

但是,您是否嘗試從託管在其服務器或桌面應用程序上的網站進行連接? – FeliceM

回答

0

請檢查您的連接字符串並直接獲取您正在使用哪個DBMS。

連接字符串SQL Server

Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername; 
Password=myPassword; 

MySQL

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; 

你已經宣佈你正在使用MySQL連接字符串但是您的連接字符串定義

providerName="System.Data.SqlClient 

如果一切正常的話,我會建議你檢查一下設置建議如下Blog

相關問題