Microsoft.Azure.ServiceBus 2.0.0消息的意外编码或内容

问题描述 投票:0回答:1

我正在使用Microsoft.Azure.ServiceBus 2.0.0来订阅队列消息,并在使用Encoding.UTF8.GetString(serviceBusMessage.Body)时获得意外的字符。

enter image description here

看起来消息内容应该是有效的XML,但肯定不是。

发送消息的代码使用旧的WindowsAzure.ServiceBus 4.1.6库,如下所示:

private void SendToProcessingQueue(Guid accountId, Message msg) { string queueName = msg.MessageType.ToLower(); var client = CreateQueueClient(queueName); client.Send(new BrokeredMessage(new MessageHint() { AccountId = accountId, MessageId = msg.Id, MessageType = msg.MessageType })); }

新旧图书馆是不兼容的吗?

azureservicebus azure-servicebus-queues
1个回答
0
投票

是不兼容的 - 我能够在重新实现类库.NET 4.7而不是.NET Standard 2.0并引用WindowsAzure.ServiceBus 4.1.7而不是Microsoft.Azure.ServiceBus 2.0.0之后解析消息。 API大致相同,所以重新实现只需要15分钟。

enter image description here

更新:如果有人知道如何在两个版本之间交换消息,请发布另一个答案,说明应该如何完成。

© www.soinside.com 2019 - 2024. All rights reserved.