I am using nodejs, msmq and .net as technology stack in my project. I am collecting data from hardware using nodejs script and writing into MSMQ. I want to read this MSMQ in .net but I am getting below error. In addition I am not able to receive the message as well.
Error System.Xml.XmlException: Data at the root level is invalid. Line 1, position at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) 'objMessage.ConnectorType' threw an exception of type 'System.InvalidOperationException' 'objMessage.Body' threw an exception of type 'System.Xml.XmlException'
//Nodejs script
const msmq = require('updated-node-msmq');
const queue = msmq.openOrCreateQueue('.\\Private$\\EEG');
queue.send(records);
// C# code
if (MessageQueue.Exists(@".\Private$\EEG")){
objMessageQueue = new MessageQueue(@".\Private$\EEG");
}
objMessage = objMessageQueue.Receive();
objMessage.Formatter = new XmlMessageFormatter(new Type[]
{typeof(Payload) });
var message = (Payload)objMessage.Body;