Cannot find a formatter capable of reading this message. [Resolved]

Posted by Poster under C# on 2/5/2010 | Views : 14005 | Status : [Member] | Replies : 1
I am able to send the message to MSMQ but while receving I am getting following error.

Cannot find a formatter capable of reading this message.


Please help.

Thanks




Responses

Posted by: Raja on: 2/5/2010 [Member] Starter

Up
0
Down

Resolved
Your MessageQueue instance should have a Formatter property set like below.

try

{
if (!MessageQueue.Exists(@".\Private$\MyTestQueue"))
{
q = MessageQueue.Create(@".\Private$\MyTestQueue");
}
else
{
q = new MessageQueue(@".\Private$\MyTestQueue");
}
q.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });
}
catch (MessageQueueException ee)
{
throw ee;
}


Set Formatter property of the MessageQueue and you will not get this error.

Thanks

Regards,
Raja, USA

Poster, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response