I have a Gui running on a server with the IIS and the SQL database both on the same machine.
开发者_Go百科I have this connectionstring in the webconfig.
Data Source=localhost\SQLEXPRESS;Initial Catalog=XYZDB;Integrated Security=True
Now i want to access another database on a different server, i thought it would just take me to change "localhost" to the machine server name, but that is not working.
any idea how should i go about doing this..
Any help is greatly appreciated
Thank you.
Error message:
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)
In Data Source, localhost is the name of the server and SQLEXPRESS is the named instance of SQL running on that server.
So either you do not have a named instance on the new server or the named instance is different.
OR like Kevin said, your instance is not accepting outside connections.
I would check to make sure that you instance of SqlExpress will accept outside connections:
http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx
精彩评论