通过打开数据库连接测试网络连接

发布于 2024-11-27 17:54:10 字数 744 浏览 0 评论 0原文

我有一个小的 .net 2.0 系统托盘应用程序(C#),可以定期检查网络连接。它通过尝试打开与另一台计算机上的 SQL-Server 实例的连接(并从表中选择一行)来实现此目的。当应用程序找到连接时,会将另一个进程创建的文档保存到数据库中。它将用于无线网络可能存在风险的环境中。

在测试中,我们的 QA 团队在数据库服务器(托管 Sql-Server 2005 数据库)上使用 ipconfig /Release。我们发现应用程序继续声称它已连接网络,因为它一直成功打开与 SQL Server 的连接。我在自己使用 ipconfig /release 进行的测试中发现系统托盘应用程序的行为不稳定。

根据我们当前不在场的网络人员的建议,我更改了自己的内部测试(托管在虚拟机上的应用程序,连接到我的工作站上的数据库)以关闭虚拟机网络连接。这会产生预期的行为(系统托盘应用程序找不到网络连接)。质量检查人员对我的建议有点怀疑,他们也这样做,我需要让他们放心。

  1. 有人建议我 SQL Server 使用命名管道来接受传入连接。如果启用了命名管道和 TCP/IP,这会使 ipconfig /release 测试无效吗?

  2. 我对网络了解不多。根据我所读到的内容,命名管道听起来像是为同一服务器上的应用程序之间使用而设计的。但它可以用于内网通信吗?

  3. 还有什么我不知道的事情吗?关于ipconfig /release如何工作

I have a little .net 2.0 systray app (C#) that checks for network connectivity periodically. It does this by attempting to open a connection to a SQL-Server instance on another computer (and selection a row from a table). The application saves documents created by another process to a database when it finds a connection. It is going to be used in environments with potentially dicey wireless networks.

In testing our QA team is using ipconfig /Release on the DB server (hosting a Sql-Server 2005 DB). What we found was that the application continued to claim it was network connected, because it kept right on successfully opening connections to SQL Server. I found the systray app's behavior erratic in my own testing using ipconfig /release.

At the suggestion of our not-currently-present network guy I changed my own internal testing (app hosted on a VM, connecting to DB on my workstation) to instead turn off the VM network connection. This produces the expected behavior (the systray app can't find a network connection). The QA guys are a little leery about my suggested that they do the same, and I need to put them at ease.

  1. It was suggested to me that SQL Server was using named-pipes to accept incoming connections. If Named Pipes and TCP/IP are enabled, does this invalidate the ipconfig /release test?

  2. I don't really know much about networking. Named-pipes, according to what I have read, sounds like it is designed for use between applications on the same server. But it can be used for intranet communications?

  3. Is there something else going on here that I an unware of? Something about how ipconfig /release works

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

跨年 2024-12-04 17:54:10

对于您的应用程序,我只会使用 TCP/IP 通信协议。尽管 SQL Server 支持其他通信协议(例如命名管道),但我会在您的服务器上禁用它们,以便它只接受 TCP/IP 连接。这是最少的开销,并且无论连接速度如何,都应该表现最佳。

命名管道是与 TCP/IP 不同的协议,因此释放 IP 地址可能不会以任何方式影响命名管道通信(听起来确实如此)。

在 SQL Server 计算机上,将 TCP/IP 作为第 1 号协议并禁用命名管道。让 QA 重新运行测试。我提供了一个配置屏幕截图以供参考。

Sql 服务器配置

For your application, I would only use TCP/IP communication protocol. Although SQL Server supports other communication protocols such as named pipes, I would disable them on your server so it only accepts TCP/IP connections. This is least amount of overhead and should perform the best regardless of connection speed.

Named pipes is a different protocol then TCP/IP, so releasing the IP address may not effect named pipe communication in any way (Sounds like it is).

On the SQL Server machine, put TCP/IP as the number 1 protocol and disable named pipes. The have QA re-run the test. I have included a configuration screen shot for reference.

Sql Server Config

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文