Επεξεργασία

Κοινή χρήση μέσω


MessageQueue.MachineName Property

Definition

Gets or sets the name of the computer where the Message Queuing queue is located.

public:
 property System::String ^ MachineName { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
[System.Messaging.MessagingDescription("MQ_MachineName")]
public string MachineName { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Messaging.MessagingDescription("MQ_MachineName")>]
member this.MachineName : string with get, set
Public Property MachineName As String

Property Value

The name of the computer where the queue is located. The Message Queuing default is ".", the local computer.

Attributes

Exceptions

The MachineName is null. -or-

The name of the computer is not valid, possibly because the syntax is incorrect.

An error occurred when accessing a Message Queuing method.

Examples

The following code example gets and sets the value of a message queue's MachineName property.

// Set the queue's MachineName property value to the name of the local
// computer.
queue.MachineName = ".";

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

Remarks

The MachineName is an integral component of the friendly name syntax of the queue Path. The following table shows the syntax you should use for a queue of a specified type when you want to identify the queue path using its friendly name.

Queue type Syntax
Public queue MachineName\QueueName
Private queue MachineName\Private$\QueueName
Journal queue MachineName\QueueName\Journal$
Machine journal queue MachineName\Journal$
Machine dead-letter queue MachineName\Deadletter$
Machine transactional dead-letter queue MachineName\XactDeadletter$

Use "." for the local computer when specifying the MachineName. Only the computer name is recognized for this property, for example, Server0. The MachineName property does not support the IP address format.

If you define the Path in terms of the MachineName, the application throws an exception when working offline because the domain controller is required for path translation. Therefore, you must use the FormatName for the Path syntax when working offline.

The MachineName, Path, and QueueName properties are related. Changing the MachineName property causes the Path property to change. It is built from the new MachineName and the QueueName. Changing the Path (for example, to use the format name syntax) resets the MachineName and QueueName properties to refer to the new queue. If the QueueName property is empty, the Path is set to the Journal queue of the computer you specify.

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 No

Applies to

See also