有关使用Azure Service Bus发送带有unicode(中文字符)的消息的问题。用以下代码发送带有Unicode字符的消息后:
string msgBody = JsonConvert.SerializeObject(msg);
var message = new Message(Encoding.Unicode.GetBytes(msgBody));
await QueueClient.SendAsync(message);
await QueueClient.CloseAsync();
其中,味精包含中文字符。消息触发的Azure功能崩溃并发生异常:
System.Private.CoreLib:执行函数Function1时发生异常。 Microsoft.Azure.WebJobs.Host:异常绑定参数“ myQueueItem”。 Microsoft.Azure.WebJobs.ServiceBus:内容类型为'null'的消息无法反序列化为带有消息的字符串:'反序列化类型为System.String的对象时出错。输入源的格式不正确。 System.Private.DataContractSerialization:反序列化类型为System.String的对象时发生错误。输入源的格式不正确。 System.Private.DataContractSerialization:输入源的格式不正确。
是否有使用未编码的消息触发Azure功能的想法?
答案 0 :(得分:0)
已修复! UTF8似乎运行良好。