2017-05-06 143 views
1

enter image description here不能从SQL Server 2012的

得到的数据。当我尝试登录到我的网站,就会发生错误。我也尝试过运行SQL服务。

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)

连接字符串

Data Source=.\SQLEXPRESS (metro);Initial Catalog=metrodb;Integrated Security=True 
+0

你可以请张贴你正在使用的**连接字符串**吗?该错误基本上说,该连接字符串有问题..... –

+0

我已更新我的问题与连接字符串。 –

回答

1

根据您的连接字符串,你试图连接到SQL Server 快速例如被称为SQLEXPRESS (metro) - 是真的实际名称你的实例?

通常情况下,如果你不改变任何违约,它只是SQLEXPRESS,因此您的连接字符串应该是

Data Source=.\SQLEXPRESS;Initial Catalog=metrodb;Integrated Security=True 

你可以看到你(和他们叫什么)什么SQL Server实例,当你去Start > Microsoft SQL Server > SQL Server xxxx > Configuration Tools > SQL Server Configuration Manager - 你会看到这样的事情:

enter image description here

你应该看到这是启动至少一个SQL Server (instance name)服务 - 括号中的名字我s您的实例名称(而MSSQLSERVER指的是默认的未命名实例)。那么这在你的案例中显示了什么?

+0

是的..我已经使用连接名称,而不是服务器名称connectionString。谢谢 ! –