Microsoft KB Archive/317303

= PRB: The Message Body Does Not Seem to Contain Valid Information =

PSS ID Number: 317303

Article Last Modified on 2/24/2002

-

The information in this article applies to:


 * Microsoft Message Queue Server (MSMQ) 1.0
 * Microsoft Message Queue Server (MSMQ) 2.0
 * Microsoft Message Queue Server (MSMQ) 3.0

-



This article was previously published under Q317303



SYMPTOMS
When you receive messages by using Microsoft Message Queue Server (MSMQ) Component Object Model (COM) objects that were sent through a Microsoft .NET application, the message body does seem to contain valid information.



CAUSE
This behavior occurs because the System.Messaging API formats messages differently from ActiveX API.

The ActiveX API formats the message either as a binary copy of the contents of a variant or as a COM object that is serialized by using the IPersist interface. The System.Messaging API uses XmlMessageFormatter to send a message by default.



RESOLUTION
To resolve this behavior, change the message formatter to ActiveXFormatter when you send a message by using a Visual Studio .NET application:   Create a Message Queue object: System.Messaging.MessageQueue mq = new                        System.Messaging.MessageQueue(@&quot;MachineName\QueueName&quot;);   Create a Message object: System.Messaging.Message msg = new System.Messaging.Message; msg.Body = &quot;This is a Test&quot;;   Set the message formatter to ActiveXMessageFormatter: msg.Formatter = new ActiveXMessageFormatter;   Send the message: mq.Send(msg); 



STATUS
This behavior is by design.

