I use BizTalk 2016 and have configured default settings in BizTalk MSMQ adapter (body type 8209).
I am trying to receive message from c# code but get the following exception:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Messaging.dll
Additional information: Cannot deserialize the message passed as an argument. Cannot recognize the serialization format.
Code used (slimmed):
message = messageQueue.Receive();
message.Formatter = new ActiveXMessageFormatter();
document.Load(message.Body.ToString());
Exception is thrown when I access the Body property of the message, which triggers the formatter to access the message content.
I have tried to specify a formatter, and tried a few different types, but they are not working. I fear that there are som Byte Order Marks on the data, that needs to be removed manually. Is that really the case?
I would assume this need is quite common, strange to get stuck on this...!? Please put me on track on this!