简体   繁体   English

MSMQ。 显示邮件正文

[英]MSMQ. Displaying message body

I faced the problem of display message body. 我遇到了显示消息正文的问题。 I send test message (using XmlFormatter) to queue using C# (I have Windows 7). 我发送测试消息(使用XmlFormatter)以使用C#排队(我使用Windows 7)。

How can I remove hex from message body preview? 如何从邮件正文预览中删除十六进制?

在此处输入图片说明

I found interesting moment: if body less 612 bytes - xml display is ok, but if body more 612 bytes - appears hex. 我发现有趣的时刻:如果正文少了612个字节-xml显示正常,但是如果正文多了612个字节-出现了十六进制。

在此处输入图片说明

I can't use BinaryFormatter, because I need show in the message property (body) clear xml. 我不能使用BinaryFormatter,因为我需要在message属性(正文)中显示clear xml。 (If use BinaryFormatter, hex displayed too). (如果使用BinaryFormatter,也会显示十六进制)。 I tried create custom (TxtFormatter) formatter - hex displayed too. 我尝试创建自定义(TxtFormatter)格式化程序-也显示了十六进制。

I found solution. 我找到了解决方案。 Just need use ActiveXMessageFormatter 只需要使用ActiveXMessageFormatter

If you are using XmlMessageFormatter() while passing a non-XML string, you should ensure the following: 如果在传递非XML字符串的同时使用XmlMessageFormatter() ,则应确保满足以下条件:

  1. If message is an object, ensure that it has the attribute [Serializable] . 如果message是对象,请确保其具有[Serializable]属性。 Otherwise, the message body will be hexadecimal format. 否则,邮件正文将为十六进制格式。
  2. Ensure the resulting serialized object attributes map correctly and have valid values, if defined in an XSD (XML Schema Definition) file. 如果在XSD(XML架构定义)文件中定义了结果,则确保生成的序列化对象属性正确映射并具有有效值。

Or you could use MSMQ Studio to view MSMQ messages. 或者,您可以使用MSMQ Studio查看MSMQ消息。 https://msmq-studio.com https://msmq-studio.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM