开发者

IIS to access SQL server on different machine

开发者 https://www.devze.com 2023-01-20 04:27 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号