Cannot find suitable formatter for custom class object
- by Ganesha87
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."