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

前端 未结 9 1961
耶瑟儿~
耶瑟儿~ 2020-12-15 16:24

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 follow

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 17:00

    you could try reading the bodystream of the message instead of the body, like this:

    StreamReader sr = new StreamReader(m.BodyStream);    
    string messageBody = "";    
    while (sr.Peek() >= 0) 
    {
        messageBody += sr.ReadLine();
    }
    

提交回复
热议问题