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

前端 未结 9 1766
耶瑟儿~
耶瑟儿~ 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:11

    Message recoverableMessage = new Message();
    recoverableMessage.Body = "Sample Recoverable Message";
    
    recoverableMessage.Formatter = new XmlMessageFormatter(new String[] {"System.String,mscorlib" });
    
    MessageQueue myQueue = new MessageQueue(@".\private$\teste");
    

    Queue must be set Formatter too.

    myQueue.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
    

提交回复
热议问题