【问题标题】:First call to Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync times out, subsequent calls don't第一次调用 Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync 超时,后续调用不会
【发布时间】:2019-03-07 19:47:34
【问题描述】:

我编写了一些代码来与 azure 服务总线通信。它将消息发送到队列。它在一个针对 .net 标准 2.0 的项目中

当我从 .net 核心终端应用程序运行它时,它运行良好。但是,当从 .net 框架 4.7.2 项目调用相同的代码时,第一次尝试发送消息会在 30 到 90 秒后导致以下异常:

"The remote party closed the WebSocket connection without completing the close handshake."

但是任何进一步的消息都会毫无问题地发送。

// This is using Microsoft.Azure.ServiceBus, if that makes any difference... 

MessageSender MessageSender  = new MessageSender(ConnectionString, SendQueueName;

try
{
     await MessageSender.SendAsync(new Message(Encoding.UTF8.GetBytes("Test that won't work")));
}
catch(Exception e)
{
    // Error will be caught here:
    // "The remote party closed the WebSocket connection without completing the close handshake."
}
await MessageSender.SendAsync(new Message(Encoding.UTF8.GetBytes("Test that will work")));

有人知道为什么第一次通话失败吗?以及如何让它不失败?还是更快地失败?我已尝试更改 OperationTimeout 和 RetryPolicy,但它们似乎没有任何效果。

【问题讨论】:

    标签: azure servicebus


    【解决方案1】:

    这些第一个连接是通过端口 5671/56712 进行的,趋势防病毒软件会拦截该端口。一旦这些超时,框架就会回退到使用 443,它工作正常。

    我们尝试关闭 Trend 并运行测试连接,几乎是即时的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多