【发布时间】:2021-11-16 16:43:25
【问题描述】:
最近更新到当前库 12.8 以进行 azure 队列处理。 插入的消息不再适用于现有例程,因为它们被编码为 UTF-8 vs Base 64。
找到讨论这个的线程,看到 MS 已经实现了一种设置编码的新方法。 https://github.com/Azure/azure-sdk-for-net/issues/10242
但是,我无法设置编码,只需要朝正确的方向推动即可。 这是一个 .NET 4.8 控制台应用程序 我目前使用的代码:
private static void insertQueueMessage(string messageToInsert, string queueName)
{
// Get the connection string from app settings
string connectionString = ConfigurationManager.AppSettings["StorageConnectionString"];
// Instantiate a QueueClient which will be used to create and manipulate the queue
QueueClient queueClient = new QueueClient(connectionString, queueName);
// Send a message to the queue
queueClient.SendMessage(messageToInsert);
}
我尝试过的:
queueClient.SendMessage(messageToInsert,QueueMessageEncoding.Base64);
和
QueueClient queueClient = new QueueClient(connectionString, queueName,QueueMessageEncoding.Base64);
如何编码才能工作?
【问题讨论】:
-
我发布了答案,谢谢@GauravMantri
标签: c# .net azure azure-queues