SQL Server Connection String - Different Domain
I have a SQL Server connection string in a config file:
<add name="DbMaster" connectionString="Data Source=ServerName\NamedInstance;Initial Catalog=SomeDb;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
This is fine if I am running from the domain where the SQL Server is located, but I receive the following error on a different domain:
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)
There is a trust between the domains开发者_如何学C.
I tried the following with no success:
<add name="DbMaster" connectionString="Data Source=ServerName.DOMAIN.COM\NamedInstance;Initial Catalog=SomeDb;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
I can ping ServerName.DOMAIN.COM.
I have tried connecting to the SQL Server on a different domain using SQL Server Management Studio but the same error as above is received.
Is there something obvious I am doing wrong?
If Management Studio is giving you the same error, the problem isn't with your application. The problem is with your SQL Server configuration.
Either the Trust between the Domains isn't properly configured to enable Integrated Security across domains or the SQL Server isn't properly configured to allow remote connections (like the error message states).
Integrated Security across domains is usually much more hassle than it's worth. Using SQL Server Authentication will relieve most of your headaches.
精彩评论