与SQL Server的初始连接连接速度慢。为什么? [英] Initial connection to SQL Server Connection Is Slow. Why?

查看:584
本文介绍了与SQL Server的初始连接连接速度慢。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个情况,一个C#应用程序安装在两个站点,其中与SQL Server的初始连接非常慢。我写了一个测试应用程序来验证减速发生在哪里,它是在第一个SQLConnection.Open语句。大约41秒钟通过命名管道建立与服务器的连接。我们认为这可能是DNS问题,但它使用TCP / IP连接速度一样慢。在初始连接建立后,连接被池化,应用程序正常响应。工作站和服务器都是运行Windows 7 Pro,Core 2 Duo 3.16 Ghz和4 gig Ram的体面机器。我在微软论坛上发现了以下文章:



http://social.msdn.microsoft.com/Forums/en/windowscompatibility/thread/f295994c-5812-4e46-8ac9-f05471d4dd54



关闭LLMNR协议将初始连接时间减少了大约一半到21秒。但是,这仍然需要很长时间才能获得与SQL Server的初始连接。唯一与我们的规范略有不同的是,在这种情况下的DNS是通过路由器而不是实际的服务器。这只发生在两个地方到目前为止,其他运行没有问题。



谢谢你,
Dennis

解决方案>

我已经找到了!这个问题使我NUTS一个月左右...



在服务器前面的连接字符串,添加no:这变成Server = np: server\stance。这将强制命名管道,而不是默认的tcp。那是它...那是IT!



你也可以改变优先级,在tcp ...之前使用命名管道,但我不想混淆



43秒到小于1 ...我的项目已保存!


I have run into a situation with a C# application installed at two sites where the initial connection to SQL Server is extremely slow. I wrote a test application to verify where the slowdown occurs and it is on the first SQLConnection.Open statement. It was taking about 41 seconds to establish a connection to the server via named pipes. We thought it might be a DNS issue but its just as slow using a TCP/IP connection. After the initial connection is made the connection is pooled and the application responds normally. Both the workstation and the server are decent machines running Windows 7 Pro, Core 2 Duo 3.16 Ghz with 4 gig of Ram. I did find the following article on a microsoft forum:

http://social.msdn.microsoft.com/Forums/en/windowscompatibility/thread/f295994c-5812-4e46-8ac9-f05471d4dd54

Turning off the LLMNR protocol did cut the initial connection time in about half to 21 seconds. However, this is still a long time to get an initial connection to SQL Server. The only things slightly different from our norm is that DNS in this case is done thru a router and not an actual server. This has occurred at only two places so far, others run with no issues. Any help would be appreciated.

Thank You, Dennis

解决方案

I have found it!!!!! This problem has made me NUTS for a month or so...

In front of the server on the connection string, add "no:" This becomes Server=np:server\instance. This forces the Named Pipes instead of the default of tcp. That was it... that was IT!

You can probably also change the priority to use named pipes before tcp... but I did not want to mess with that on the server.

43 seconds to less than 1... my project is saved!

这篇关于与SQL Server的初始连接连接速度慢。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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