使用 SRV DNS 条目连接到 .NET 中的 SQL Server

发布于 2024-07-25 19:16:10 字数 303 浏览 3 评论 0原文

我们有一个 SQL Server 集群,并使用 SRV DNS 条目来定位服务(即 sql.mycompany.com)。

MyCompany.com_tcp_http Service Location (SRV) [0][0][1433]sql.Mycompany.com

现在,我如何使用 .NET SQLConnection 来使用此 dns 名称(而不是服务器名称/IP)? 有任何想法吗?
我应该先使用System.Net.Dns来翻译它吗?

We have a cluster SQL Server and we use a SRV DNS entry to locate the service (i.e sql.mycompany.com).

MyCompany.com_tcp_http Service Location (SRV) [0][0][1433]sql.Mycompany.com

Now, how I can use the .NET SQLConnection to use this dns name (instead of the server name/IP)? Any ideas?
Should I use System.Net.Dns to translate it first?

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

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

发布评论

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

评论(1

叫嚣ゝ 2024-08-01 19:16:10

.NET SQLConnection 不会查找 SRV 记录,只会查找 A 记录。

所以,是的,您需要自己使用 System.Net.Dns 查询 SRV 记录,解析并在连接字符串中使用结果。

A .NET SQLConnection will not look up SRV records, only A records.

So yes, you will need to query your SRV record using System.Net.Dns yourself, parse and use the result in your connection string.

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