MessageQueue.DenySharedReceive 屬性

定義

取得或設定值,指出這個 MessageQueue 是否具有從訊息佇列接收訊息的獨佔存取權。Gets or sets a value that indicates whether this MessageQueue has exclusive access to receive messages from the Message Queuing queue.

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

屬性值

Boolean

如果這個 MessageQueue 具有從佇列接收訊息的獨佔權限,則為 true,否則為 falsetrue if this MessageQueue has exclusive rights to receive messages from the queue; otherwise, false. 預設為 falseThe default is false.

屬性

範例

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

// Set the queue's DenySharedReceive property value.
queue.DenySharedReceive = false;

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

備註

DenySharedReceive 指定這個所參考之佇列的共用模式 MessageQueueDenySharedReceive specifies the shared mode of the queue referenced by this MessageQueue. 設定 DenySharedReceive 為, true 表示只有這 MessageQueue 應該可以存取,才能使用指定的來查看或接收佇列中的訊息 PathSet DenySharedReceive to true to indicate that only this MessageQueue should have access to peek or receive messages from the queue with the specified Path. 如果另一個 MessageQueue 或另一個應用程式與相同的佇列資源相關聯,該實例或應用程式將無法查看或接收訊息,但仍可傳送訊息。If another MessageQueue or another application is associated with the same queue resource, that instance or application will not be able to peek or receive messages, but it can still send them.

如果 DenySharedReceivefalse ,則佇列可供多個應用程式用來傳送、查看或接收訊息。If DenySharedReceive is false, the queue is available to multiple applications for sending, peeking, or receiving messages.

下表顯示此屬性是否適用于各種工作組模式。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 Yes
遠端電腦和直接格式名稱Remote computer and direct format name Yes

適用於

另請參閱