Cannot find suitable formatter for custom class object

Posted by Ganesha87 on Stack Overflow See other posts from Stack Overflow or by Ganesha87
Published on 2010-04-13T07:35:02Z Indexed on 2010/04/15 20:23 UTC
Read the original article Hit count: 318

Filed under:
|
|
|

I'm writing messages to a Message Queue in C# as follows:

ObjectMsg objMsg = new ObjMsg(1,"ascii",20090807);
Message m = new Message();
m.Formatter = new BinaryMessageFormatter();
m.body = objMsg;
queue.Send(m);

and I'm trying to read the messages as follows:

Message m = new Message()
m.Formatter = new BinaryMessageFormatter();
MessageQueue mq = new MessageQueue("./pqueue");

m = mq.Recieve();
ObjMsg msg = (ObjMsg )m.Body;

However I'm getting an error message which says: "Cannot find a formatter capable of reading this message."

© Stack Overflow or respective owner

Related posts about .net-3.5

Related posts about msmq