MessageQueue.Authenticate 属性

定义

获取或设置一个值,该值指示队列是否仅接受经过身份验证的消息。Gets or sets a value that indicates whether the queue accepts only authenticated messages.

public:
 property bool Authenticate { bool get(); void set(bool value); };
[System.Messaging.MessagingDescription("MQ_Authenticate")]
public bool Authenticate { get; set; }
[<System.Messaging.MessagingDescription("MQ_Authenticate")>]
member this.Authenticate : bool with get, set
Public Property Authenticate As Boolean

属性值

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 将限制对服务器上的队列的访问,而不仅限于此 MessageQueue 实例。When 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. 若要请求拒绝消息,发送应用程序可以设置消息的 AcknowledgeType 属性。To 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

适用于

另请参阅