0

我有一个本地数据库“模型”,我需要通过我的 2 个应用程序连接到它。一个应用程序仅基于我的数据库“模型”中定义的表的子集。我的连接字符串是

<add name="Model"
     connectionString="Data Source=localhost;Initial Catalog=Model;Integrated Security=True;Trusted_Connection=true;"
     providerName="System.Data.SqlClient" />

我对两个应用程序使用相同的连接字符串。应用程序 1(更少的表)可以很好地连接和加载数据。问题是应用程序 2 向我抛出错误:

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)

网上的所有解决方案都是基于检查我是否有正确的连接字符串以及是否启用了远程会话,这一切都有效,因为我的应用程序 1 有效。应用程序 2 可能出了什么问题?我应该从哪里开始寻找问题?

4

1 回答 1

0

尝试将数据源更改为, (local)或者如果您正在运行 SQL Express,请尝试(local)\SQLEXPRESS

失败了,你不能看看“应用程序 1”正在使用的连接字符串吗?

于 2013-01-14T15:56:37.123 回答