SQL Server 2012的连接字符串:再也找不到服务器? [英] SQL Server 2012 connection string: can no longer find Server?

查看:1834
本文介绍了SQL Server 2012的连接字符串:再也找不到服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚安装了VS2012临区和SQL服务器前preSS 2012年我去跑我的应用程序,我得到这个错误:

I just installed VS2012 pro RC and SQL server Express 2012. I go to run my app and I get this error:

在连接刺痛数据源值指定SQL Server实例
      未安装。要解决此问题,您可以选择安装
      的SQL Server实例相匹配或修改数据源值
      连接字符串。

The Data Source value in the connection sting specifies an instance of SQL Server that is not installed. To resolve this issue, you can either choose to install the matching instance of SQL Server or modify the Data Source value in the connection string.

我用VS2012开发preVIEW很长一段时间,它用来工作就好了。这是连接字符串是在web.config文件:

I used VS2012 Developer preview for a long time and it used to work just fine. This is the connection string that's in the web.config file:

<add name="MySiteDBConnectionString"
     connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MySiteDB.mdf;Integrated Security=True;User Instance=True"
     providerName="System.Data.SqlClient"/>

当我去Management Studio中,我得到以下错误消息。当我去浏览服务器,列表是空的。

When I go to Management Studio, I get the error message below. When I go to browse for servers, the list is empty.

在哪里的问题,我该如何解决呢?

Where's the problem and how do I solve it?

感谢。

Thanks.

推荐答案

您需要确保SQL Server服务正在运行。当你使用的web.config 建立连接和愚蠢的 AttachDbFileName 功能的Visual Studio可能会旋转起来给你。检查您的服务控制面板小程序,并确保 SQL服务器(SQLEX preSS)正在运行。如果它没有运行,启动它。

You need to make sure the SQL Server service is running. Visual Studio might be spinning it up for you when you establish a connection using web.config and that silly AttachDbFileName feature. Check your Services Control Panel applet and make sure that SQL Server (SQLEXPRESS) is running. If it isn't running, start it.

当你在那里,它不能伤害,以确保 SQL浏览器服务正在运行。

While you're there, it can't hurt to make sure the SQL Browser service is running.

它也不能伤害到使用正确的情况。如果实例名为 SQLEX $ P $干燥综合征那么就不能称之为 SqlEx preSS SQLEx preSS 。我从来没有听说过这个破连接,但要保持一致。您也可以尝试其他的变化,以防万一:

It also can't hurt to use the proper case. If the instance is called SQLEXPRESS then don't call it SqlExpress or SQLExpress. I've never heard of this breaking connectivity, but be consistent. You might also try other variations just in case:

(本地)\\ SQLEX $ P $干燥综合征结果
本地主机\\ SQLEX $ P $干燥综合征结果
127.0.0.1 \\ SQLEX $ P $干燥综合征结果
Your_Computer_Name \\ SQLEX $ P $干燥综合征

您也应该检查哪些连接协议此实例启用。转到开始>程序> SQL Server>配置工具>配置管理器中展开SQL Server网络配置,并突出显示协议SQLEX $ P $干燥综合征 - 你应该看到正确的共享内存,命名管道,TCP / IP。哪些是启用?

You should also verify what connection protocols are enabled for this instance. Go to Start > Programs > SQL Server > Configuration Tools > Configuration Manager, expand SQL Server Network Configuration, and highlight Protocols for SQLEXPRESS - on the right you should see Shared Memory, Named Pipes, TCP/IP. Which of these are enabled?

修改

您应该从这里下载SQL Server 2012前preSS 。安装。然后创建一个数据库。在该数据库中指向的Visual Studio。停下来,我真正的意思的停止,使用用户实例 AttachDbFileName 功能。这些东西都应该使开发更容易,但在这一天结束时,他们做一点,但使发展在后一个皇家疼痛。

You should download SQL Server 2012 Express from here. Install it. Then create a database. Point Visual Studio at that database. Stop, and I really mean STOP, using the User Instance and AttachDbFileName features. These things are supposed to make development easier but at the end of the day they do little but make development a royal pain in the rear.

另一种选择是使用 SqlLocalDb 的地方发展。上个月,我写了一个<一个href=\"http://www.mssqltips.com/sqlservertip/2694/getting-started-with-sql-server-2012-ex$p$pss-localdb/\"相对=nofollow>彻底入门的教程可能会有所帮助。

Another option is to use SqlLocalDb for local development. Last month I wrote a thorough "Getting Started" tutorial that may help.

这篇关于SQL Server 2012的连接字符串:再也找不到服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆