来自C#.NET 3.5的Localdb连接 [英] Localdb connection from c# .net 3.5

查看:109
本文介绍了来自C#.NET 3.5的Localdb连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在.net 3.5中创建了一个Windows应用程序.当我在开发计算机(已安装的应用程序,而不是来自VS)上运行它时,我可以使用服务器名(localdb)\v11.0连接到本地db数据库服务器.在客户端计算机上启动时,使用此服务器名时出现异常.当我使用命名管道服务器名称时,我可以连接并查询数据库.

We created a windows application in .net 3.5. When i run it on my development machine (installed application, not from VS) i can connect to a local db database server using the servername: (localdb)\v11.0. When starting on the client's computer i get an exception when using this servername. When i use the named-pipe servername i can connect and query the databases.

在我的开发计算机上,我还可以从SSMS(Express)2008 R2 SP2连接到(localdb)\v11.0.这在客户端计算机上也不起作用.

On my development machine i can also connect to (localdb)\v11.0 from SSMS (Express) 2008 R2 SP2. This also does not work on the client's machine.

有人知道客户端计算机上缺少什么并安装在我的开发计算机上吗?

Anyone got any idee what is missing on the clients machine and is installed on my development machine?

来自SSMS的错误消息:

Errormessage from SSMS:


无法连接到(localdb)\ v11.0.


Cannot connect to (localdb)\v11.0.

Er是netexpkfout的示例,也是SQL Server的示例.服务器是Niet Toegankelijk的Niet Gevonden.正确的示例控件是在SQL Server的外部控件中正确使用的. (提供者:SQL-netwerkinterfaces,错误:26-Fout bij zoeken van opgegeven服务器/示例)(.Net SqlClient数据提供程序)

Er is een netwerkfout of een exemplaarspecifieke fout opgetreden tijdens het maken van verbinding met SQL Server. De server is niet gevonden of is niet toegankelijk. Controleer of de exemplaarnaam correct is en of in de instellingen van SQL Server externe verbindingen zijn toegestaan. (provider: SQL-netwerkinterfaces, error: 26 - Fout bij zoeken van opgegeven server/exemplaar) (.Net SqlClient Data Provider)

有关帮助,请单击:错误号:-1 严重程度:20 状态:0

Error Number: -1 Severity: 20 State: 0

更新:

从Management Studio 2008 R2 SP2执行以下查询时:

UPDATE:

When Executing the following query from management studio 2008 R2 SP2:

选择net_transport 从sys.dm_exec_connections session_id = @@ SPID;

SELECT net_transport FROM sys.dm_exec_connections WHERE session_id = @@SPID;

结果: 命名管道

因此,SSMS知道如何使用命名管道连接到(localdb)\ v11.0.检查属性时,命名管道名称也在那里并且以某种方式被检索到.

So Somehow SSMS knows to connect to the (localdb)\v11.0 using named pipes. When checking the propperties, the named-pipe name is also there and is somehow retrieved.

运行相同的查询时,普通的SQL Server(本地sqlexpress)返回TCP,并且在查看属性时,服务器名称也可见.

Normal SQL-Servers (local sqlexpress) return TCP when running the same query and also the servername is visibile when viewing the properties.

阅读推荐的文章(查看评论) post ,可以使用.NET3.5编译程序进行连接的人更多.我还发现很多帖子都说需要.net 4.0.3.由于Windows 7默认情况下安装.net 4.5,因此我假设满足.net 4.0.3要求是否正确?

Reading the recommended (see comments) post, there are more people who can connect using a .NET3.5 compiled program. I also found a lot of posts saying .net 4.0.3 is required. Since Windows 7 installs .net 4.5 by default, is it correct that i assume the .net 4.0.3 requirement is met?

2014-12-22:同时,该产品已经在多台(用户)PC上进行了测试.在大多数PC上,它可以按我希望的方式运行.用户可以使用(localdb)\ v11.0"连接字符串进行连接.即使未安装Visual Studio 2012.

2014-12-22: Meanwhile the product has been tested on several (user) PC. On most of the PC it functions as I would like it to function. Users can connect using the "(localdb)\v11.0" connection string. Even if Visual Studio 2012 is not installed.

这可以是Microsoft的可选更新程序,可以解决此问题吗?如果是这样,哪个?

Can it be an optional update from Microsoft which fixes the issue? And if so, which one?

推荐答案

与此类似,但仅在您安装了Visual Studio 2012的情况下,它才像在.Net 3.5中修复的一样. http://support.microsoft.com/kb/2664825

Looks like its fixed in .Net 3.5 with this, but only if you have Visual Studio 2012 installed. http://support.microsoft.com/kb/2664825

我在这里找到了单独的下载: http://thehotfixshare.net/board/index.php?showtopic=17253

I found a separate download here: http://thehotfixshare.net/board/index.php?showtopic=17253

这篇关于来自C#.NET 3.5的Localdb连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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