第一次调用 Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync 超时,后续调用不会
First call to Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync times out, subsequent calls don't
我编写了一些代码来与 Azure 服务总线进行通信。它将消息发送到队列。它在一个针对 .net 标准 2.0 的项目中
当我从 .net 核心终端应用程序 运行 时,它 运行 没问题。但是,当从 .net Framework 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,但它们似乎没有任何效果。
这些第一个连接是通过端口 5671/56712 进行的,Trend 杀毒软件拦截了该端口。一旦这些超时,框架就会回退到使用 443,这工作正常。
我们尝试关闭趋势并 运行 测试连接及其几乎瞬时的连接。
我编写了一些代码来与 Azure 服务总线进行通信。它将消息发送到队列。它在一个针对 .net 标准 2.0 的项目中
当我从 .net 核心终端应用程序 运行 时,它 运行 没问题。但是,当从 .net Framework 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,但它们似乎没有任何效果。
这些第一个连接是通过端口 5671/56712 进行的,Trend 杀毒软件拦截了该端口。一旦这些超时,框架就会回退到使用 443,这工作正常。
我们尝试关闭趋势并 运行 测试连接及其几乎瞬时的连接。