System.Messaging 命名空間

System.Messaging 命名空間提供類別以連接、監控和管理網路上的訊息佇列,以及傳送、接收或窺視 (Peek) 訊息。 The System.Messaging namespace provides classes that allow you to connect to, monitor, and administer message queues on the network and send, receive, or peek messages.

類別

AccessControlEntry

指定信任項 (Trustee) (使用者、群組或電腦) 的存取權限,以執行應用程式專有的一般性工作實作。Specifies access rights for a trustee (user, group, or computer) to perform application-specific implementations of common tasks.

AccessControlList

包含存取控制項目的清單,指定一或多個信任者的存取權限。Contains a list of access control entries, specifying access rights for one or more trustees.

ActiveXMessageFormatter

使用與 MSMQ ActiveX 元件相容的格式,將訊息佇列訊息主體的基本資料型別和其他物件序列化或還原序列化。Serializes or deserializes primitive data types and other objects to or from the body of a Message Queuing message, using a format that is compatible with the MSMQ ActiveX Component.

BinaryMessageFormatter

使用二進位格式將訊息佇列訊息的主體序列化或還原序列化物件,或連接物件的整個圖解。Serializes or deserializes an object, or an entire graph of connected objects, to or from the body of a Message Queuing message, using a binary format.

Cursor

讀取佇列的訊息時,會使用 Cursor 保持 MessageQueue 中的特定位置。A Cursor is used to maintain a specific location in a MessageQueue when reading the queue's messages.

DefaultPropertiesToSend

指定傳送 Message 執行個體 (Instance) 以外的物件至訊息佇列時將使用的預設屬性值。Specifies the default property values that will be used when sending objects other than Message instances to a message queue.

Message

提供定義訊息佇列訊息所需屬性的存取。Provides access to the properties needed to define a Message Queuing message.

MessageEnumerator

提供順向資料指標 (Cursor),以列舉訊息佇列中的訊息。Provides a forward-only cursor to enumerate through messages in a message queue.

MessagePropertyFilter

控制並選取當由訊息佇列窺視或接收訊息時所擷取的屬性。Controls and selects the properties that are retrieved when peeking or receiving messages from a message queue.

MessageQueue

提供 Message Queuing 伺服器上的佇列存取。Provides access to a queue on a Message Queuing server.

MessageQueueAccessControlEntry

指定信任項 (Trustee) (使用者、群組或電腦) 執行訊息佇列工作的存取權。Specifies access rights for a trustee (user, group, or computer) to perform Message Queuing tasks.

MessageQueueCriteria

在使用 MessageQueue 類別的 GetPublicQueues() 方法執行查詢時,篩選訊息佇列。Filters message queues when performing a query using the MessageQueue class's GetPublicQueues() method.

MessageQueueEnumerator

提供順向資料指標 (Cursor),以列舉訊息佇列中的訊息。Provides a forward-only cursor to enumerate through messages in a message queue.

MessageQueueException

發生 Microsoft Message Queuing 內部錯誤時,所擲回的例外狀況。The exception that is thrown if a Microsoft Message Queuing internal error occurs.

MessageQueueInstaller

讓您安裝和設定執行應用程式時需要的佇列 (Queue)。Allows you to install and configure a queue that your application needs in order to run. 安裝 MessageQueue 時,安裝公用程式 (如 InstallUtil.exe) 會呼叫這個類別。This class is called by the installation utility, for example, InstallUtil.exe, when installing a MessageQueue.

MessageQueuePermission

允許控制訊息處理的程式碼存取使用權限。Allows control of code access permissions for messaging.

MessageQueuePermissionAttribute

允許宣告式 MessageQueue 使用權限檢查。Allows declarative MessageQueue permission checks.

MessageQueuePermissionEntry

定義傳送訊息時的程式碼存取安全性權限集合的最小單位。Defines the smallest unit of a code access security permission set for messaging.

MessageQueuePermissionEntryCollection

包含 MessageQueuePermissionEntry 物件的強類型集合。Contains a strongly typed collection of MessageQueuePermissionEntry objects.

MessageQueueTransaction

提供訊息佇列內部交易。Provides a Message Queuing internal transaction.

MessagingDescriptionAttribute

指定屬性或事件的描述。Specifies a description for a property or event.

PeekCompletedEventArgs

提供 PeekCompleted 事件的資料。Provides data for the PeekCompleted event. 當非同步窺視作業 (Asynchronous Peek Operation) 呼叫事件處理常式時,會將這個類別的執行個體 (Instance) 傳遞至處理常式。When your asynchronous peek operation calls an event handler, an instance of this class is passed to the handler.

ReceiveCompletedEventArgs

提供 ReceiveCompleted 事件的資料。Provides data for the ReceiveCompleted event. 當非同步 (Asynchronous) 接收作業呼叫事件處理常式時,會將這個類別的執行個體 (Instance) 傳遞至處理常式。When your asynchronous receive operation calls an event handler, an instance of this class is passed to the handler.

SecurityContext

表示佇列中訊息的安全性內容。Represents the security context for a message in a queue.

Trustee

指定存取控制項目套用的使用者帳戶、群組帳戶或登入工作階段 (Session)。Specifies a user account, group account, or logon session to which an access control entry applies.

XmlMessageFormatter

使用根據 XSD 結構描述定義的 XML 格式,將物件序列化為訊息主體,或從訊息主體還原序列化為物件。Serializes and deserializes objects to or from the body of a message, using the XML format based on the XSD schema definition.

介面

IMessageFormatter

序列化或還原序列化訊息佇列訊息主體中的物件。Serializes or deserializes objects from the body of a Message Queuing message.

列舉

AccessControlEntryType

指定是否允許、拒絕、或撤銷信任項 (Trustee) 的存取權限。Specifies whether to allow, deny, or revoke access rights for a trustee.

AcknowledgeTypes

指定 Message Queuing 傳回給傳送應用程式的通知訊息型別。Specifies the types of acknowledgment message that Message Queuing returns to the sending application.

Acknowledgment

指定訊息傳遞的結果。Specifies the result of an attempted message delivery.

CryptographicProviderType

指定驗證數位簽章時可用的密碼編譯服務提供者。Specifies the cryptographic service providers available for validating digital signatures.

EncryptionAlgorithm

指定用來加密私用 (Private) 訊息的訊息主體的加密 (Encryption) 演算法。Specifies the encryption algorithm used to encrypt the message body of a private message.

EncryptionRequired

指定佇列收到的訊息其私用層級。Specifies the privacy level of messages received by the queue.

GenericAccessRights

使用 Windows 2000 和 Windows NT 存取格式,指定 Message Queuing 對應至讀取、寫入和執行之標準和物件特定存取權限的通用存取權限集。Uses the Windows 2000 and Windows NT access format to specify a set of common access rights that Message Queuing maps to both standard and object-specific access rights for reading, writing, and executing.

HashAlgorithm

指定訊息佇列在驗證訊息時所使用的雜湊演算法。Specifies the hash algorithm used by Message Queuing when authenticating messages.

MessageLookupAction

指定要從訊息佇列窺視或接收的訊息。Specifies a message to peek at or receive from a message queue.

MessagePriority

指定訊息佇列在抵達佇列途中以及將訊息插入目的佇列時,套用至訊息的優先權。Specifies the priority Message Queuing applies to a message while it is en route to a queue, and when inserting the message into the destination queue.

MessageQueueAccessRights

指定訊息佇列專屬作業的物件專用存取權集合。Specifies a set of object-specific access rights for operations specific to Message Queuing.

MessageQueueErrorCode

識別在訊息佇列應用程式內發生的錯誤來源,並產生 MessageQueueException 例外狀況。Identifies the source of an error that occurred within the Message Queuing application and generated a MessageQueueException exception.

MessageQueuePermissionAccess

定義 System.Messaging 使用權限類別所使用的存取等級。Defines access levels used by System.Messaging permission classes.

MessageQueueTransactionStatus

指定內部訊息佇列交易的狀態。Specifies the state of an internal Message Queuing transaction.

MessageQueueTransactionType

指定訊息佇列交易型別。Specifies the type of a Message Queuing transaction.

MessageType

辨認訊息的型別。Identifies the type of a message. 訊息可以是一般訊息佇列訊息、正 (抵達與讀取) 或負 (抵達與讀取) 通知訊息或報告訊息。A message can be a typical Message Queuing message, a positive (arrival and read) or negative (arrival and read) acknowledgment message, or a report message.

PeekAction

指出窺視佇列中目前的訊息,還是下一則訊息。Indicates whether to peek the current message in a queue, or the next message.

QueueAccessMode

在建立階段指定 MessageQueue 的存取模式。Specifies the access mode for a MessageQueue at creation time.

StandardAccessRights

指定標準存取權集合以對應至通用於大部分安全物件型別的作業。Specifies a set of standard access rights that correspond to operations common to most types of securable objects.

TrusteeType

指定信任項 (Trustee) 的型別。Specifies the type of a trustee.

委派

PeekCompletedEventHandler

代表將處理 PeekCompletedMessageQueue 事件的方法。Represents the method that will handle the PeekCompleted event of a MessageQueue.

ReceiveCompletedEventHandler

代表將處理 ReceiveCompletedMessageQueue 事件的方法。Represents the method that will handle the ReceiveCompleted event of a MessageQueue.

備註

成員MessageQueue類別包含下列方法來讀取和寫入訊息至佇列:Members of the MessageQueue class include the following methods for reading and writing messages to the queue:

  • Send方法可讓您的應用程式將訊息寫入至佇列。The Send method enables your application to write messages to the queue. 方法的多載可讓您指定是否要傳送訊息使用Message(以提供詳細控制您所傳送的資訊) 或任何其他 managed 的物件,包括應用程式特定類別。Overloads of the method enable you to specify whether to send your message using a Message (which provides detailed control over the information you send) or any other managed object, including application-specific classes. 方法會為交易的一部分,也支援傳送訊息。The method also supports sending messages as part of a transaction.

  • ReceiveReceiveById,和ReceiveByCorrelationId方法提供從佇列讀取訊息的功能。The Receive, ReceiveById, and ReceiveByCorrelationId methods provide functionality for reading messages from a queue. 例如Send方法,這些方法會提供多載,可支援交易式佇列處理。Like the Send method, these methods provide overloads that support transactional queue processing. 這些方法也會提供多載的逾時。These methods also provide overloads with time-out.

    Out 參數,讓處理作業能夠繼續佇列是否空白。Out parameters that enable processing to continue if the queue is empty. 因為這些方法是同步處理的範例,而中斷目前的執行緒,直到訊息可以的話,除非您指定逾時。Because these methods are examples of synchronous processing, they interrupt the current thread until a message is available, unless you specify a time-out.

  • Peek方法是類似於Receive,但它不會造成讀取時,從佇列移除訊息。The Peek method is similar to Receive, but it does not cause a message to be removed from the queue when it is read. 因為Peek不會變更佇列的內容中,有沒有多載,可以支援交易式處理。Because Peek does not change the queue contents, there are no overloads to support transactional processing. 不過,因為Peek,例如Receive,以同步方式從佇列讀取訊息,方法的多載支援指定的逾時,以避免執行緒無限期等候。However, because Peek, like Receive, reads messages synchronously from the queue, overloads of the method do support specifying a time-out in order to prevent the thread from waiting indefinitely.

  • BeginPeekEndPeek(IAsyncResult)BeginReceive,和EndReceive(IAsyncResult)方法提供以非同步方式從佇列讀取訊息的方式。The BeginPeek, EndPeek(IAsyncResult), BeginReceive, and EndReceive(IAsyncResult) methods provide ways to asynchronously read messages from the queue. 它們不會中斷目前的執行緒等待訊息到達佇列中。They do not interrupt the current thread while waiting for a message to arrive in the queue.

下列方法MessageQueue類別提供用來擷取所指定準則的佇列的清單,並判斷特定的佇列是否存在的功能:The following methods of the MessageQueue class provide functionality for retrieving lists of queues by specified criteria and determining if specific queues exist:

其他方法MessageQueue類別提供下列功能:Other methods of the MessageQueue class provide the following functionality:

  • 建立和刪除訊息佇列的佇列。Creating and deleting Message Queueing queues.

  • 若要逐步執行佇列中的訊息使用訊息的列舉值。Using a message enumerator to step through the messages in a queue.

  • 使用佇列的列舉值逐一查看系統上的佇列。Using a queue enumerator for iterating through the queues on the system.

  • 設定 ACL 為基礎的存取權限。Setting ACL-based access rights.

  • 若要使用的連線快取。Working with the connection cache.

Message類別會提供詳細的資訊傳送到佇列中,控制,而且使用物件接收或窺視訊息從佇列中時。The Message class provides detailed control over the information you send to a queue, and is the object used when receiving or peeking messages from a queue. 除了訊息內文,而屬性Message類別包含通知設定、 格式器選取項目、 識別、 驗證和加密的資訊、 時間戳記、 使用追蹤、 伺服器日誌的相關指示和寄不出信件佇列和交易資料。Besides the message body, the properties of the Message class include acknowledgment settings, formatter selection, identification, authentication and encryption information, timestamps, indications about using tracing, server journaling, and dead-letter queues, and transaction data.

MessageQueue元件是與下列三個格式器,可讓您序列化和還原序列化訊息從佇列傳送和接收相關聯:The MessageQueue component is associated with the following three formatters, which enable you to serialize and deserialize messages sent and received from queues:

  • XmlMessageFormatter提供鬆散偶合的傳訊,啟用用戶端和伺服器上的序列化類型的獨立版本設定。The XmlMessageFormatter provides loosely coupled messaging, enabling independent versioning of serialized types on the client and server.

  • ActiveXMessageFormatter適用於 MSMQ COM 控制項。The ActiveXMessageFormatter is compatible with the MSMQ COM control. 它可讓您傳送控制項可接收的類型,並接收已由控制項傳送的類型。It allows you to send types that can be received by the control and to receive types that were sent by the control.

  • BinaryMessageFormatter提供更快速的替代方法,來XmlMessageFormatter,但不使用鬆散偶合的傳訊的優點。The BinaryMessageFormatter provides a faster alternative to the XmlMessageFormatter, but without the benefit of loosely coupled messaging.

中的其他類別Messaging命名空間支援程式碼存取權和 ACL 為基礎的安全性篩選Message時從佇列讀取訊息,並使用交易時傳送和接收訊息的屬性。Other classes in the Messaging namespace support code-access and ACL-based security, filtering Message properties when reading messages from a queue, and using transactions when sending and receiving messages.