2010-12-01 25 views
1

我有一個配置文件中的SQL Server連接字符串:SQL Server連接字符串 - 不同的域

<add name="DbMaster" connectionString="Data Source=ServerName\NamedInstance;Initial Catalog=SomeDb;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/> 

這是好的,如果我從那裏在SQL Server所在的域運行,但我收到以下錯誤在不同的域上:

System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

域之間存在信任關係。

我嘗試沒有成功如下:

<add name="DbMaster" connectionString="Data Source=ServerName.DOMAIN.COM\NamedInstance;Initial Catalog=SomeDb;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/> 

我可以ping ServerName.DOMAIN.COM。

我已經嘗試使用SQL Server Management Studio連接到不同域上的SQL Server,但是收到了與上面相同的錯誤。

有什麼明顯的我做錯了嗎?

+0

您是否驗證過SQL Server配置爲接受遠程連接,如錯誤消息所示? – 2010-12-01 15:46:29

回答

3

如果Management Studio向您提供相同的錯誤,則問題不在於您的應用程序。問題出在你的SQL Server配置上。

未正確配置域之間的信任以啓用跨域的集成安全性,或者SQL Server未正確配置爲允許遠程連接(如錯誤消息狀態)。

跨域的集成安全性通常比它的價值更麻煩。使用SQL Server身份驗證可以緩解您的大部分難題。