SQL LocalDB中的实例特定错误 [英] Instance Specific error in SQL LocalDB

查看:95
本文介绍了SQL LocalDB中的实例特定错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含SQL localDB(v11.0)的项目。当我在m PC上运行时,它运行得很好,但是当我在其他PC上运行时,我得到了这个错误。我正在使用Visual Studio 2013



---------------------------- ----------------------------------

与网络相关或特定于实例的建立与SQL Server的连接时发生错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:50 - 发生本地数据库运行时错误。无法创建自动实例。请参阅Windows应用程序事件日志以获取错误详细信息。

--------- -------------------------------------------------- ---



我的连接App.config文件中的字符串是

-------------- ---------------------------------------

connectionString =数据源=(LocalDB)\ v11.0; AttachDbFilename = | DataDirectory | \ EMSDB.mdf; Integrated Security = True

-------------- -------------------------------------------------- --------------

I have a project that contains SQL localDB(v11.0).When I run on m PC it runs perfectly, but when I run it on other pc I get this error. I am Using Visual Studio 2013

--------------------------------------------------------------
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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
--------------------------------------------------------------

My connection String in App.config file is
-----------------------------------------------------
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\EMSDB.mdf;Integrated Security=True"
------------------------------------------------------------------------------

推荐答案

LocalDB表示在此计算机上 - 所以如果您已将代码移动到不同的PC,那么你需要更改连接字符串以引用安装了生产SQL服务器实例的计算机。



这不应该是你开发的计算机软件 - 永远不会测试生产代码d atabases,除非你真的想快速寻找新的工作 - 你不应该用你的软件在每台PC上自动安装SQL服务器。
"LocalDB" means "on this computer" - so if you have moved your code to a different PC, then you need to change the connection string to refer to the computer with the production SQL server instance installed on it.

This should not be the computer you develop software on - never, ever test code against production databases, unless you really like looking for new jobs quickly - and you shouldn't automatically install SQL server on every PC with your software.


你需要更新你的连接字符串以匹配任何东西安装在该服务器上或更改它以指向安装了SQL的计算机。
You need to update your connection string to match whatever is installed on that server or change it to point back to your computer that does have SQL installed on it.


您需要在将要使用它的计算机上安装LocalDB;你不能简单地将文件复制到计算机并运行应用程序。

You need to install LocalDB on the computer which will be using it; you can't simply copy the files to the computer and run the application.



主要方法通过使用SqlLocalDB.msi程序安装LocalDB。安装任何SKU的SQL Server 2012 Express时,LocalDB是一个选项。在安装SQL Server Express期间,在功能选择页面上选择LocalDB。每个主要的SQL Server数据库引擎版本只能安装一个LocalDB二进制文件。可以启动多个数据库引擎进程,并且所有进程都使用相同的二进制文件。 SQL Server数据库引擎的一个实例启动,因为LocalDB具有与SQL Server Express相同的限制


The primary method of installing LocalDB is by using the SqlLocalDB.msi program. LocalDB is an option when installing any SKU of SQL Server 2012 Express. Select LocalDB on the Feature Selection page during installation of SQL Server Express. There can be only one installation of the LocalDB binary files for each major SQL Server Database Engine version. Multiple Database Engine processes can be started and will all use the same binaries. An instance of the SQL Server Database Engine started as the LocalDB has the same limitations as SQL Server Express



下载 SQLLocalDB。 msi 来自 SQL Express下载页面的文件[ ^ ]并安装在目标计算机上。


Download the SQLLocalDB.msi file from the SQL Express download page[^] and install it on the target computer.


这篇关于SQL LocalDB中的实例特定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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