Message 类

定义

提供对定义消息队列消息所需的属性的访问。Provides access to the properties needed to define a Message Queuing message.

public ref class Message : System::ComponentModel::Component
public class Message : System.ComponentModel.Component
type Message = class
    inherit Component
Public Class Message
Inherits Component
继承

示例

下面的代码示例演示如何使用格式化消息正文 BinaryMessageFormatterThe following code example demonstrates formatting a message body using BinaryMessageFormatter.

#using <system.dll>
#using <system.messaging.dll>
#using <system.drawing.dll>

using namespace System;
using namespace System::Messaging;
using namespace System::Drawing;
using namespace System::IO;

/// <summary>
/// Provides a container class for the example.
/// </summary>
ref class MyNewQueue
{
public:

   //*************************************************
   // Creates a new queue.
   //*************************************************
   static void CreateQueue( String^ queuePath )
   {
      try
      {
         if (  !MessageQueue::Exists( queuePath ) )
         {
            MessageQueue::Create( queuePath );
         }
         else
         {
            Console::WriteLine(  "{0} already exists.", queuePath );
         }
      }
      catch ( MessageQueueException^ e ) 
      {
         Console::WriteLine( e->Message );
      }

   }


   //*************************************************
   // Sends an image to a queue, using the BinaryMessageFormatter.
   //*************************************************
   void SendMessage()
   {
      try
      {
         
         // Create a new bitmap.
         // The file must be in the \bin\debug or \bin\retail folder, or
         // you must give a full path to its location.
         Image^ myImage = Bitmap::FromFile( "SentImage::bmp" );
         
         // Connect to a queue on the local computer.
         MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );
         Message^ myMessage = gcnew Message( myImage,gcnew BinaryMessageFormatter );
         
         // Send the image to the queue.
         myQueue->Send( myMessage );
      }
      catch ( ArgumentException^ e ) 
      {
         Console::WriteLine( e->Message );
      }

      return;
   }


   //*************************************************
   // Receives a message containing an image.
   //*************************************************
   void ReceiveMessage()
   {
      try
      {
         
         // Connect to the a queue on the local computer.
         MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );
         
         // Set the formatter to indicate body contains an Order.
         myQueue->Formatter = gcnew BinaryMessageFormatter;
         
         // Receive and format the message. 
         Message^ myMessage = myQueue->Receive();
         Bitmap^ myImage = static_cast<Bitmap^>(myMessage->Body);
         
         // This will be saved in the \bin\debug or \bin\retail folder.
         myImage->Save( "ReceivedImage::bmp", System::Drawing::Imaging::ImageFormat::Bmp );
      }
      catch ( MessageQueueException^ ) 
      {
         
         // Handle Message Queuing exceptions.
      }
      // Handle invalid serialization format.
      catch ( InvalidOperationException^ e ) 
      {
         Console::WriteLine( e->Message );
      }
      catch ( IOException^ e ) 
      {
         
         // Handle file access exceptions.
      }

      
      // Catch other exceptions as necessary.
      return;
   }

};


//*************************************************
// Provides an entry point into the application.
//         
// This example sends and receives a message from
// a queue.
//*************************************************
int main()
{
   
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;
   
   // Create a queue on the local computer.
   MyNewQueue::CreateQueue( ".\\myQueue" );
   
   // Send a message to a queue.
   myNewQueue->SendMessage();
   
   // Receive a message from a queue.
   myNewQueue->ReceiveMessage();
   return 0;
}

using System;
using System.Messaging;
using System.Drawing;
using System.IO;

namespace MyProject
{

    /// <summary>
    /// Provides a container class for the example.
    /// </summary>
    public class MyNewQueue
    {

        //**************************************************
        // Provides an entry point into the application.
        //		
        // This example sends and receives a message from
        // a queue.
        //**************************************************

        public static void Main()
        {
            // Create a new instance of the class.
            MyNewQueue myNewQueue = new MyNewQueue();

            // Create a queue on the local computer.
            CreateQueue(".\\myQueue");
            
            // Send a message to a queue.
            myNewQueue.SendMessage();

            // Receive a message from a queue.
            myNewQueue.ReceiveMessage();

            return;
        }

        //**************************************************
        // Creates a new queue.
        //**************************************************

        public static void CreateQueue(string queuePath)
        {
            try	
            {
                if(!MessageQueue.Exists(queuePath))
                {
                    MessageQueue.Create(queuePath);
                }
                else
                {
                    Console.WriteLine(queuePath + " already exists.");
                }
            }
            catch (MessageQueueException e)
            {
                Console.WriteLine(e.Message);
            }
        }

        //**************************************************
        // Sends an image to a queue, using the BinaryMessageFormatter.
        //**************************************************
        
        public void SendMessage()
        {
            try{

                // Create a new bitmap.
                // The file must be in the \bin\debug or \bin\retail folder, or
                // you must give a full path to its location.
                Image myImage = Bitmap.FromFile("SentImage.bmp");

                // Connect to a queue on the local computer.
                MessageQueue myQueue = new MessageQueue(".\\myQueue");
                
                Message myMessage = new Message(myImage, new BinaryMessageFormatter());

                // Send the image to the queue.
                myQueue.Send(myMessage);
            }
            catch(ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }

            return;
        }

        //**************************************************
        // Receives a message containing an image.
        //**************************************************
        
        public  void ReceiveMessage()
        {
                        
            try
            {

                // Connect to the a queue on the local computer.
                MessageQueue myQueue = new MessageQueue(".\\myQueue");

                // Set the formatter to indicate body contains an Order.
                myQueue.Formatter = new BinaryMessageFormatter();

                // Receive and format the message.
                System.Messaging.Message myMessage = myQueue.Receive();
                Bitmap myImage = (Bitmap)myMessage.Body;
                
                // This will be saved in the \bin\debug or \bin\retail folder.
                myImage.Save("ReceivedImage.bmp",System.Drawing.Imaging.ImageFormat.Bmp);
            }
            
            catch (MessageQueueException)
            {
                // Handle Message Queuing exceptions.
            }

            // Handle invalid serialization format.
            catch (InvalidOperationException e)
            {
                Console.WriteLine(e.Message);
            }

            catch (IOException e)
            {
                // Handle file access exceptions.
            }
            
            // Catch other exceptions as necessary.

            return;
        }
    }
}
Imports System.Messaging
Imports System.Drawing
Imports System.IO


Namespace MyProj
    _
   
   
   Public Class MyNewQueue
      
      
      '**************************************************
      ' Provides an entry point into the application.
      '		 
      ' This example sends and receives a message from
      ' a queue.
      '**************************************************
      Public Shared Sub Main()
         ' Create a new instance of the class.
         Dim myNewQueue As New MyNewQueue()
         
         ' Create a queue on the local computer.
         CreateQueue(".\myQueue")
         
         ' Send a message to a queue.
         myNewQueue.SendMessage()
         
         ' Receive a message from a queue.
         myNewQueue.ReceiveMessage()
         
         Return
      End Sub
      
      
      '**************************************************
      ' Creates a new queue.
      '**************************************************
      Public Shared Sub CreateQueue(queuePath As String)
         Try
            If Not MessageQueue.Exists(queuePath) Then
               MessageQueue.Create(queuePath)
            Else
               Console.WriteLine((queuePath + " already exists."))
            End If
         Catch e As MessageQueueException
            Console.WriteLine(e.Message)
         End Try
      End Sub
       
      
      '**************************************************
      ' Sends an image to a queue, using the BinaryMessageFormatter.
      '**************************************************
      Public Sub SendMessage()
         Try
            
            ' Create a new bitmap.
            ' The file must be in the \bin\debug or \bin\retail folder, or
            ' you must give a full path to its location.
            Dim myImage As Image = Bitmap.FromFile("SentImage.bmp")
            
            ' Connect to a queue on the local computer.
            Dim myQueue As New MessageQueue(".\myQueue")
            
            Dim myMessage As New Message(myImage, New BinaryMessageFormatter())
            
            ' Send the image to the queue.
            myQueue.Send(myMessage)
         Catch e As ArgumentException
            Console.WriteLine(e.Message)
         End Try 
         
         Return
      End Sub
      
      
      
      '**************************************************
      ' Receives a message containing an image.
      '**************************************************
      Public Sub ReceiveMessage()
         
         Try
            
            ' Connect to the a queue on the local computer.
            Dim myQueue As New MessageQueue(".\myQueue")
            
            ' Set the formatter to indicate body contains an Order.
            myQueue.Formatter = New BinaryMessageFormatter()
            
            ' Receive and format the message. 
            Dim myMessage As System.Messaging.Message = myQueue.Receive()
            Dim myImage As Bitmap = CType(myMessage.Body, Bitmap)
            
            ' This will be saved in the \bin\debug or \bin\retail folder.
            myImage.Save("ReceivedImage.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
         
         
         
         'Catch
         ' Handle Message Queuing exceptions.
         
         ' Handle invalid serialization format.
         Catch e As InvalidOperationException
            Console.WriteLine(e.Message)
         
         Catch e As IOException
         End Try
         ' Handle file access exceptions.
         
         ' Catch other exceptions as necessary.
         Return
      End Sub
   End Class
End Namespace 'MyProj

下面的代码示例演示如何使用格式化消息正文 XmlMessageFormatterThe following code example demonstrates formatting a message body using XmlMessageFormatter.

#using <system.dll>
#using <system.messaging.dll>
#using <system.drawing.dll>

using namespace System;
using namespace System::Messaging;
using namespace System::Drawing;
using namespace System::IO;
ref class Order
{
public:
   int orderId;
   DateTime orderTime;
};

ref class MyNewQueue
{
public:
   static void CreateQueue( String^ queuePath )
   {
      try
      {
         if (  !MessageQueue::Exists( queuePath ) )
         {
            MessageQueue::Create( queuePath );
         }
         else
         {
            Console::WriteLine(  "{0} already exists.", queuePath );
         }
      }
      catch ( MessageQueueException^ e ) 
      {
         Console::WriteLine( e->Message );
      }

   }

   void SendMessage()
   {
      try
      {
         // Create a new order and set values.
         Order^ sentOrder = gcnew Order;
         sentOrder->orderId = 3;
         sentOrder->orderTime = DateTime::Now;

         // Connect to a queue on the local computer.
         MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );

         // Create the new order.
         Message^ myMessage = gcnew Message( sentOrder );

         // Send the order to the queue.
         myQueue->Send( myMessage );
      }
      catch ( ArgumentException^ e ) 
      {
         Console::WriteLine( e->Message );
      }

      return;
   }

   void ReceiveMessage()
   {
      // Connect to the a queue on the local computer.
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );

      // Set the formatter to indicate body contains an Order.
      array<Type^>^p = gcnew array<Type^>(1);
      p[ 0 ] = Order::typeid;
      myQueue->Formatter = gcnew XmlMessageFormatter( p );
      try
      {
         // Receive and format the message. 
         Message^ myMessage = myQueue->Receive();
         Order^ myOrder = dynamic_cast<Order^>(myMessage->Body);

         // Display message information.
         Console::WriteLine( "Order ID: {0}", myOrder->orderId );
         Console::WriteLine( "Sent: {0}", myOrder->orderTime );
      }
      catch ( MessageQueueException^ ) 
      {
         // Handle Message Queuing exceptions.
      }
      // Handle invalid serialization format.
      catch ( InvalidOperationException^ e ) 
      {
         Console::WriteLine( e->Message );
      }

      // Catch other exceptions as necessary.
      return;
   }
};

int main()
{
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;

   // Create a queue on the local computer.
   MyNewQueue::CreateQueue( ".\\myQueue" );

   // Send a message to a queue.
   myNewQueue->SendMessage();

   // Receive a message from a queue.
   myNewQueue->ReceiveMessage();
   return 0;
}
using System;
using System.Messaging;
using System.Drawing;
using System.IO;

namespace MyProject
{

    // The following example
    // sends to a queue and receives from a queue.
    public class Order
    {
        public int orderId;
        public DateTime orderTime;
    };	

    /// <summary>
    /// Provides a container class for the example.
    /// </summary>
    public class MyNewQueue
    {

        //**************************************************
        // Provides an entry point into the application.
        //		
        // This example sends and receives a message from
        // a queue.
        //**************************************************

        public static void Main()
        {
            // Create a new instance of the class.
            MyNewQueue myNewQueue = new MyNewQueue();

            // Create a queue on the local computer.
            CreateQueue(".\\myQueue");
            
            // Send a message to a queue.
            myNewQueue.SendMessage();

            // Receive a message from a queue.
            myNewQueue.ReceiveMessage();

            return;
        }

        //**************************************************
        // Creates a new queue.
        //**************************************************

        public static void CreateQueue(string queuePath)
        {
            try	
            {
                if(!MessageQueue.Exists(queuePath))
                {
                    MessageQueue.Create(queuePath);
                }
                else
                {
                    Console.WriteLine(queuePath + " already exists.");
                }
            }
            catch (MessageQueueException e)
            {
                Console.WriteLine(e.Message);
            }
        }

        //**************************************************
        // Sends an Order to a queue.
        //**************************************************
        
        public void SendMessage()
        {
            try
            {

                // Create a new order and set values.
                Order sentOrder = new Order();
                sentOrder.orderId = 3;
                sentOrder.orderTime = DateTime.Now;

                // Connect to a queue on the local computer.
                MessageQueue myQueue = new MessageQueue(".\\myQueue");

                // Create the new order.
                Message myMessage = new Message(sentOrder);

                // Send the order to the queue.
                myQueue.Send(myMessage);
            }
            catch(ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }

            return;
        }

        //**************************************************
        // Receives a message containing an order.
        //**************************************************
        
        public  void ReceiveMessage()
        {
            // Connect to the a queue on the local computer.
            MessageQueue myQueue = new MessageQueue(".\\myQueue");

            // Set the formatter to indicate body contains an Order.
            myQueue.Formatter = new XmlMessageFormatter(new Type[]
                {typeof(MyProject.Order)});
            
            try
            {
                // Receive and format the message.
                Message myMessage =	myQueue.Receive();
                Order myOrder = (Order)myMessage.Body;

                // Display message information.
                Console.WriteLine("Order ID: " +
                    myOrder.orderId.ToString());
                Console.WriteLine("Sent: " +
                    myOrder.orderTime.ToString());
            }
            
            catch (MessageQueueException)
            {
                // Handle Message Queuing exceptions.
            }

                // Handle invalid serialization format.
            catch (InvalidOperationException e)
            {
                Console.WriteLine(e.Message);
            }
            
            // Catch other exceptions as necessary.

            return;
        }
    }
}
Imports System.Messaging
Imports System.Drawing
Imports System.IO



   
' The following example 
' sends to a queue and receives from a queue.
Public Class Order
      Public orderId As Integer
      Public orderTime As DateTime
End Class

   
  
' Provides a container class for the example.

Public Class MyNewQueue
      
      

   ' Provides an entry point into the application.
   '		 
   ' This example sends and receives a message from
   ' a queue.

   Public Shared Sub Main()
      ' Create a new instance of the class.
      Dim myNewQueue As New MyNewQueue()
        
      ' Create a queue on the local computer.
      CreateQueue(".\myQueue")
         
      ' Send a message to a queue.
      myNewQueue.SendMessage()
       
      ' Receive a message from a queue.
      myNewQueue.ReceiveMessage()
         
      Return
   End Sub
      
      

      ' Creates a new queue.
   Public Shared Sub CreateQueue(queuePath As String)
      Try
         If Not MessageQueue.Exists(queuePath) Then
            MessageQueue.Create(queuePath)
         Else
            Console.WriteLine((queuePath + " already exists."))
         End If
      Catch e As MessageQueueException
         Console.WriteLine(e.Message)
      End Try
   End Sub
       
      

      ' Sends an Order to a queue.

   Public Sub SendMessage()
      Try
            
            ' Create a new order and set values.
            Dim sentOrder As New Order()
            sentOrder.orderId = 3
            sentOrder.orderTime = DateTime.Now
            
            ' Connect to a queue on the local computer.
            Dim myQueue As New MessageQueue(".\myQueue")
            
            
            
            ' Create the new order.
            Dim myMessage As New Message(sentOrder)
            
            ' Send the order to the queue.
            myQueue.Send(myMessage)
      Catch e As ArgumentException
            Console.WriteLine(e.Message)
      End Try 
         
      Return
   End Sub
      
      
      
 
      ' Receives a message containing an order.
 
   Public Sub ReceiveMessage()
         ' Connect to the a queue on the local computer.
         Dim myQueue As New MessageQueue(".\myQueue")
         
         ' Set the formatter to indicate body contains an Order.
         myQueue.Formatter = New XmlMessageFormatter(New Type() {GetType(Order)})
         
         Try
            ' Receive and format the message. 
            Dim myMessage As Message = myQueue.Receive()
            Dim myOrder As Order = CType(myMessage.Body, Order)
            
            ' Display message information.
            Console.WriteLine(("Order ID: " + myOrder.orderId.ToString()))
            Console.WriteLine(("Sent: " + myOrder.orderTime.ToString()))
         
  
         ' Handle invalid serialization format.
         Catch e As InvalidOperationException
            Console.WriteLine(e.Message)
         End Try
         
         ' Catch other exceptions as necessary.
         Return
   End Sub
End Class

注解

使用 Message 类查看或接收来自队列的消息,或在将消息发送到队列时对消息属性进行精细控制。Use the Message class to peek or receive messages from a queue, or to have fine control over message properties when sending a message to a queue.

MessageQueue 使用 Message 类查看或接收来自队列的消息时,因为 MessageQueue.PeekMessageQueue.Receive 方法都创建类的新实例 Message 并设置该实例的属性。MessageQueue uses the Message class when it peeks or receives messages from queues, because both the MessageQueue.Peek and MessageQueue.Receive methods create a new instance of the Message class and set the instance's properties. Message类的只读属性适用于从队列中检索消息,而读取/写入属性应用于发送和检索消息。The Message class's read-only properties apply to retrieving messages from a queue, while the read/write properties apply to sending and retrieving messages. MessageQueue扫视或接收来自队列的消息时,其 MessageReadPropertyFilter 属性将确定检索消息的哪些属性。When MessageQueue peeks or receives a message from a queue, its MessageReadPropertyFilter property determines which of the message's properties are retrieved.

使用 MessageQueue 类的 Send 方法可以为发送到该队列的消息指定任何对象类型。The MessageQueue class's Send method allows you to specify any object type for a message being sent to that queue. 您可以使用 MessageQueue 实例的 DefaultPropertiesToSend 属性来指定发送到队列的一般消息的设置。You can use the MessageQueue instance's DefaultPropertiesToSend property to specify settings for generic messages sent to the queue. 设置类型包括格式化程序、标签、加密和身份验证。The types of settings include formatter, label, encryption, and authentication. DefaultPropertiesToSend 协调消息传递应用程序以响应确认和报告消息时,还可以指定相应成员的值。You can also specify values for the appropriate DefaultPropertiesToSend members when you coordinate your messaging application to respond to acknowledgment and report messages. 使用 Message 实例将消息发送到队列,你可以灵活地访问和修改其中的许多属性-无论是单个消息还是按消息。Using a Message instance to send a message to the queue gives you the flexibility to access and modify many of these properties - either for a single message or on a message-by-message basis. Message 属性优先于 DefaultPropertiesToSendMessage properties take precedence over DefaultPropertiesToSend.

消息数据存储在属性中 Body ,并在较小的范围内存储 AppSpecificExtension 属性。Message data is stored in the Body property and to a lesser extent, the AppSpecific and Extension properties. 对消息数据进行加密、序列化或反序列化时,仅 Body 影响属性的内容。When message data is encrypted, serialized, or deserialized, only the contents of the Body property are affected.

Body发送消息时,将使用指定的属性对属性的内容进行序列化 FormatterThe contents of the Body property are serialized when the message is sent, using the Formatter property you specify. 序列化的内容位于属性中 BodyStreamThe serialized contents are found in the BodyStream property. 您还可以直接设置 BodyStream 属性,例如,将文件作为消息的数据内容发送。You can also set the BodyStream property directly, for example, to send a file as the data content of a message. 你可以随时更改 BodyFormatter 属性,然后再发送消息,并且在调用时,将相应地序列化数据 SendYou can change the Body or Formatter properties at any time before sending the message, and the data will be serialized appropriately when you call Send.

属性定义的属性 MessageQueue.DefaultPropertiesToSend 仅适用于不属于类型的消息 MessageThe properties defined by the MessageQueue.DefaultPropertiesToSend property apply only to messages that are not of type Message. 如果 DefaultPropertiesToSend 为指定了属性,则 MessageQueue 发送到该队列的实例中的名称相同的属性将 Message 导致忽略这些默认属性。If you specify the DefaultPropertiesToSend property for a MessageQueue, the identically named properties in a Message instance sent to that queue cause these default properties to be ignored.

有关实例的初始属性值的列表 Message ,请参见 Message 构造函数。For a list of initial property values for an instance of Message, see the Message constructor.

构造函数

Message()

初始化 Message 类的新实例(主体为空)。Initializes a new instance of the Message class with an empty body.

Message(Object)

通过用 Message 将指定的对象序列化到消息体中,初始化 XmlMessageFormatter 类的新实例。Initializes a new instance of the Message class, using the XmlMessageFormatter to serialize the specified object into the body of the message.

Message(Object, IMessageFormatter)

初始化 Message 类的新实例,使用指定的格式化程序将指定的对象序列化到消息体中。Initializes a new instance of the Message class using the specified formatter to serialize the specified object into the body of the message.

字段

InfiniteTimeout

指定不存在超时。Specifies that no time-out exists.

属性

AcknowledgeType

获取或设置返回给发送应用程序的确认消息的类型。Gets or sets the type of acknowledgment message to be returned to the sending application.

Acknowledgment

获取该消息表示的确认分类。Gets the classification of acknowledgment that this message represents.

AdministrationQueue

获取或设置接收由消息队列生成的确认消息的队列。Gets or sets the queue that receives the acknowledgement messages that Message Queuing generates.

AppSpecific

获取或设置应用程序特定的附加信息。Gets or sets additional, application-specific information.

ArrivedTime

获取消息到达目标队列的时间。Gets the time that the message arrived in the destination queue.

AttachSenderId

获取或设置一个值,该值指示发送方 ID 是否应附在消息中。Gets or sets a value that indicates whether the sender ID should be attached to the message.

Authenticated

获取一个值,该值指示消息是否已验证。Gets a value that indicates whether the message was authenticated.

AuthenticationProviderName

获取或设置用于生成消息数字签名的加密提供程序的名称。Gets or sets the name of the cryptographic provider used to generate the digital signature of the message.

AuthenticationProviderType

获取或设置用于生成消息数字签名的加密提供程序类型。Gets or sets the type of cryptographic provider used to generate the digital signature of the message.

Body

获取或设置消息的内容。Gets or sets the content of the message.

BodyStream

获取或设置消息正文中的信息。Gets or sets the information in the body of the message.

BodyType

获取或设置消息正文所包含数据的类型。Gets or sets the type of data that the message body contains.

CanRaiseEvents

获取一个指示组件是否可以引发事件的值。Gets a value indicating whether the component can raise an event.

(继承自 Component)
ConnectorType

获取或设置一个值,该值指示由发送应用程序设置通常由消息队列设置的某些消息属性。Gets or sets a value that indicates that some message properties typically set by Message Queuing were set by the sending application.

Container

获取包含 IContainerComponentGets the IContainer that contains the Component.

(继承自 Component)
CorrelationId

获取或设置确认、报告和响应消息用以引用原始消息的消息标识符。Gets or sets the message identifier used by acknowledgment, report, and response messages to reference the original message.

DesignMode

获取一个值,用以指示 Component 当前是否处于设计模式。Gets a value that indicates whether the Component is currently in design mode.

(继承自 Component)
DestinationQueue

获取消息的预期目标队列。Gets the intended destination queue for a message.

DestinationSymmetricKey

获取或设置用于对应用程序加密的消息或发送到外部队列的消息进行加密的对称密钥。Gets or sets the symmetric key used to encrypt application-encrypted messages or messages sent to foreign queues.

DigitalSignature

获取或设置消息队列用于验证消息的数字签名。Gets or sets the digital signature that Message Queuing uses to authenticate the message.

EncryptionAlgorithm

获取或设置用于加密私有消息体的加密算法。Gets or sets the encryption algorithm used to encrypt the body of a private message.

Events

获取附加到此 Component 的事件处理程序的列表。Gets the list of event handlers that are attached to this Component.

(继承自 Component)
Extension

获取或设置与消息关联的、应用程序定义的附加信息。Gets or sets additional, application-defined information associated with the message.

Formatter

获取或设置用于将对象序列化到消息体中,或从消息体中反序列化对象的格式化程序。Gets or sets the formatter used to serialize an object into or deserialize an object from the message body.

HashAlgorithm

获取或设置消息队列在验证消息或为消息创建数字签名时使用的哈希算法。Gets or sets the hashing algorithm that Message Queuing uses when authenticating a message or creating a digital signature for a message.

Id

获取消息的标识符。Gets the message's identifier.

IsFirstInTransaction

获取一个值,该值指示消息是否是事务中发送的第一条消息。Gets a value that indicates whether the message was the first message sent in a transaction.

IsLastInTransaction

获取一个值,该值指示消息是否是事务中发送的最后一条消息。Gets a value that indicates whether the message was the last message sent in a transaction.

Label

获取或设置描述消息的应用程序定义的 Unicode 字符串。Gets or sets an application-defined Unicode string that describes the message.

LookupId

在 MSMQ 3.0 中引入。Introduced in MSMQ 3.0. 获取消息的查找标识符。Gets the message's lookup identifier.

MessageType

获取消息类型:NormalAcknowledgmentReportGets the message type: Normal, Acknowledgment, or Report.

Priority

获取或设置消息优先级,该优先级用于确定消息在队列中的位置。Gets or sets the message priority, which determines where in the queue the message is placed.

Recoverable

获取或设置一个值,该值指示在出现计算机故障或网络问题时是否保证传递消息。Gets or sets a value that indicates whether the message is guaranteed to be delivered in the event of a computer failure or network problem.

ResponseQueue

获取或设置接收应用程序生成的响应消息的队列。Gets or sets the queue that receives application-generated response messages.

SecurityContext

获取或设置消息的安全上下文。Gets or sets the security context for a message.

SenderCertificate

获取或设置用于验证消息的安全证书。Gets or sets the security certificate used to authenticate messages.

SenderId

获取发送用户的标识符。Gets the identifier of the sending user.

SenderVersion

获取用于发送消息的消息队列版本。Gets the version of Message Queuing used to send the message.

SentTime

获取发送计算机上的源队列管理器发送消息的日期和时间。Gets the date and time on the sending computer that the message was sent by the source queue manager.

Site

获取或设置 ComponentISiteGets or sets the ISite of the Component.

(继承自 Component)
SourceMachine

获取发出消息的计算机。Gets the computer from which the message originated.

TimeToBeReceived

获取或设置要从目标队列接收消息所需的最长时间。Gets or sets the maximum amount of time for the message to be received from the destination queue.

TimeToReachQueue

获取或设置消息到达队列所用的最长时间。Gets or sets the maximum amount of time for the message to reach the queue.

TransactionId

获取曾包含消息的事务的标识符。Gets the identifier for the transaction of which the message was a part.

TransactionStatusQueue

获取源计算机中的事务状态队列。Gets the transaction status queue on the source computer.

UseAuthentication

获取或设置一个值,该值指示消息发送前是否验证了(或是否必须验证)。Gets or sets a value that indicates whether the message was (or must be) authenticated before being sent.

UseDeadLetterQueue

获取或设置一个值,该值指示是否将未能传递的消息的副本发送到死信队列。Gets or sets a value that indicates whether a copy of the message that could not be delivered should be sent to a dead-letter queue.

UseEncryption

获取或设置一个值,该值指示是否使消息成为私有的。Gets or sets a value that indicates whether to make the message private.

UseJournalQueue

获取或设置一个值,该值指示是否在始发计算机的计算机日记中保留消息的副本。Gets or sets a value that indicates whether a copy of the message should be kept in a machine journal on the originating computer.

UseTracing

获取或设置一个值,该值指示是否在消息向目标队列移动的过程中跟踪消息。Gets or sets a value that indicates whether to trace a message as it moves toward its destination queue.

方法

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Dispose()

释放由 Component 使用的所有资源。Releases all resources used by the Component.

(继承自 Component)
Dispose(Boolean)

释放由 Component 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(继承自 Component)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetService(Type)

返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。Returns an object that represents a service provided by the Component or by its Container.

(继承自 Component)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
ToString()

返回包含 Component 的名称的 String(如果有)。Returns a String containing the name of the Component, if any. 不应重写此方法。This method should not be overridden.

(继承自 Component)

事件

Disposed

在通过调用 Dispose() 方法释放组件时发生。Occurs when the component is disposed by a call to the Dispose() method.

(继承自 Component)

适用于

另请参阅