【发布时间】: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