如何从.NET SDK自动检测Azure ServiceBus的协议?

发布于 2025-01-20 20:15:17 字数 464 浏览 1 评论 0 原文

I have currently upgraded to "Azure.Messaging.ServiceBus" from the legacy SDK. There was this option "ServiceBusEnvironment.SystemConnectivity.Mode" that can automatically detect amqp or https depending on the port's permission(5671 or 443). There is no such feature in the latest SDK as confirmed in this link. I now want to emulate the same feature using the latest library. However, in my network's firewall, if the outbound 5671 is denied, the exception is that the host was not found but in reality the host was there but couldn't be reached over 5671. Is there any other way to do this? Only if the 5671 is blocked by the windows firewall am I getting the socket exception which I can catch and attempt reconnection with https. This is not the same case if windows firewall allows but the underlying network blocks it. Any ideas?

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

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

发布评论

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

评论(1

Saygoodbye 2025-01-27 20:15:17

Azure.Messaging.ServiceBus 中的客户端仅使用 AMQP 协议进行通信。默认情况下,为了提高效率,直接使用 TCP 套接字建立连接。除非您已明确设置 TransportType ServiceBusClient,这就是您正在使用的。

上述 TransportType 允许您通过 Web 套接字请求 AMQP,这通常用于帮助解决您所描述的防火墙问题。如果您的环境需要,ServiceBusClientOptions 还允许您设置 Web 代理来路由流量。

The clients in Azure.Messaging.ServiceBus communicate only using the AMQP protocol. By default, connections are made using TCP sockets directly for efficiency. Unless you have explicitly set the TransportType in the ServiceBusClientOptions when creating your ServiceBusClient, that's what you're using.

The aforementioned TransportType allows you to request AMQP over web sockets, which is typically used to help work around firewall issues such as you're describing. The ServiceBusClientOptions also allows you to set a web proxy to route traffic through, should your environment require that.

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