MessageQueue.Authenticate 屬性


取得或設定值,指出佇列是否只接受已驗證的訊息。Gets or sets a value that indicates whether the queue accepts only authenticated messages.

 property bool Authenticate { bool get(); void set(bool value); };
public bool Authenticate { get; set; }
member this.Authenticate : bool with get, set
Public Property Authenticate As Boolean



如果佇列只接受驗證過的訊息則為 true,否則為 falsetrue if the queue accepts only authenticated messages; otherwise, false. 預設為 falseThe default is false.



存取訊息佇列方法時發生錯誤。An error occurred when accessing a Message Queuing method.


下列程式碼範例會取得並設定訊息佇列之屬性的值 AuthenticateThe following code example gets and sets the value of a message queue's Authenticate property.

// Set the queue's Authenticate property value.
queue.Authenticate = true;

// Display the new value of the queue's Authenticate property.
Console.WriteLine("MessageQueue.Authenticate: {0}", queue.Authenticate);


訊息驗證提供一種方法來確保訊息完整性,以及驗證訊息的傳送者。Message authentication provides a way to ensure message integrity and to verify who sent the message. 若要要求驗證,傳送應用程式會設定訊息的驗證層級。To request authentication, the sending application sets the message's authentication level.

當您將設定為時, Authenticate true 您會限制對伺服器上佇列的存取,而不只是這個實例的存取權 MessageQueueWhen you set Authenticate to true, you are restricting access to the queue on the server, not only to this MessageQueue instance. 針對相同「訊息佇列」佇列工作的所有用戶端都會受到影響。All clients working against the same Message Queuing queue will be affected.

只接受已驗證訊息的佇列會拒絕未驗證的訊息。A queue that accepts only authenticated messages will reject a non-authenticated message. 傳送應用程式可以設定訊息的屬性,以要求訊息拒絕的通知 AcknowledgeTypeTo request notification of message rejection, a sending application can set the AcknowledgeType property of the message. 因為沒有其他訊息拒絕的指示,所以傳送的應用程式可能會遺失訊息,除非您要求傳送到寄不出的信件佇列。Because no other indication of message rejection exists, the sending application can lose the message unless you request that it be sent to the dead-letter queue.

下表顯示此屬性是否適用于各種工作組模式。The following table shows whether this property is available in various Workgroup modes.

工作組模式Workgroup mode 可用Available
本機電腦Local computer Yes
本機電腦和直接格式名稱Local computer and direct format name Yes
遠端電腦Remote computer No
遠端電腦和直接格式名稱Remote computer and direct format name No