Alex Rivera | Logout

Message Queue Error: cannot find a formatter capable of reading message

Asked 2009-03-17T17:35:34.927
29

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

queue.Send(new Message("message"));

I'm trying to read the messages as follows:

Messages messages = queue.GetAllMessages();
foreach(Message m in messages)
{
  String message = m.Body;
  //do something with string
}

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

What am I doing wrong?

Edit
Report

1 Answer

25

Or you can use

 message.Formatter =
     new System.Messaging.XmlMessageFormatter(new Type[1] { typeof(string) });
answered 2009-08-18T02:00:33.807

Your Answer