消息队列写入内容后,读出来的自动包裹了<string>标签,自定义格式化器解决该issue
/// <summary> /// 该格式化器使输入即输出 /// </summary> public class StringFormatter : IMessageFormatter { public bool CanRead(Message message) { return false; } public object Read(Message message) { return null; } public void Write(Message message, object obj) { var b = Encoding.UTF8.GetBytes(obj + ""); var m = new MemoryStream(b); message.BodyStream = m; } public object Clone() { return null; } } //...... MessageQueue.Formatter = new StringFormatter(); //......