Send a message on Azure ServiceBus from .NET Core sender to a .NET 4.6 handler

耗尽温柔 提交于 2019-12-06 08:18:17

I guess the problem is because the .NET Core is publishing the message serialized as JSON to the topic but the NET 4.6 code is trying to deserialize that message from the subscription with the DataContract Serializer (XML?), as far as I know that's the default deserialization method for the full .Net framework library.

If that's the case and you cannot modify the receiving code, you will need to serialize the message with DataContractSerializer on .Net Core:

var ser = new System.Runtime.Serialization.DataContractSerializer(typeof(string));
var ms = new MemoryStream();
ser.WriteObject(ms, "hello world");
var msg = new Message(ms.ToArray());

You'll need the nuget package System.Runtime.Serialization.Xml

Sounds like an interoperability issue

The fix was merged into dev branch, but hasn't gone out yet. Scheduled for 0.0.7-preview milestone`. You can track it under the GitHub repo.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!