Azure消息队列中的消息将直接进入Poison消息队列

Mit*_*eat 4 c# queue message azure poison

[希望这可以节省某人一些时间。]

QueueClient从已弃用的类(在 Microsoft.Azure.Storage.Queue 中)移至较新的类(在 Azure.Storage.Queues 中)时,以下代码停止工作CloudQueue

QueueClient queue = new QueueClient(accountConnectionString, "myQueuename");
queue.Create();
queue.SendMessage(msg);
Run Code Online (Sandbox Code Playgroud)

消息正在被移动到关联的有害消息队列中,并且我在 Azure 的 ApplicationInsights 中没有看到任何错误消息。

当我手动将 Azure 存储资源管理器中的消息从有害消息队列移回队列时,它起作用了!

Mit*_*eat 9

该类CloudQueue默认使用base64之前的 v11 库中的编码,但事实QueueClient并非如此!

要设置base64编码,请添加QueueClientOptions

QueueClientOptions queueOptions = new() { MessageEncoding = QueueMessageEncoding.Base64 };
QueueClient queue = new QueueClient(accountConnectionString, "myQueuename", queueOptions);
queue.Create();
queue.SendMessage(msg);
Run Code Online (Sandbox Code Playgroud)