2012-08-05 65 views
0

我在我的web.config以下連接字符串:錯誤:26 - 錯誤定位服務器/實例指定。 (無法連接到我的本地數據庫)

<add name="ApplicationServices" 
    connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" 
    providerName="System.Data.SqlClient" /> 

當我試圖從我的本地IIS服務器都連接到我的本地數據庫aspnetdb.mdf工作正常,但當我把該網站在其他服務器,我收到此錯誤消息:

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).

(在我有SQL Server 2008安裝其他服務器)。

+1

[錯誤:26 - 錯誤定位服務器/實例指定錯誤。 (無法連接到我的本地Db從我的主機服務器)](http://stackoverflow.com/questions/11820168/error-26-error-locating-server-instance-specified-cant-connect-to-my-本地) – 2012-08-05 21:36:50

回答

0

(in the other server I have SQL Server 2008 installed).

看起來安裝了其他服務器上的SQL Server 2008中確實有相同的實例名稱顯示在connectionstring data source=.\SQLEXPRESS;

請更新與正確的名稱的數據源也確保它是否requries用戶ID /是否密碼

+0

嗨@HatSoft,我真的很感謝你的幫助,我如何檢查sql server中的實例? – wben 2012-08-05 17:34:24

+0

@wben如果您可以登錄該服務器並查找服務(從命令行運行services.msc),您應該看到Sql Server(實例名稱) – HatSoft 2012-08-05 17:46:00

+0

這是我在以下圖片中可以看到的:http:// stream。 tutowall.com/pic/sqlservice.png – wben 2012-08-05 17:56:56

相關問題