Export (0) Print
Expand All

MessageQueue.MachineName Property

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

Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)

public string MachineName { get; set; }
/** @property */
public String get_MachineName ()

/** @property */
public void set_MachineName (String value)

public function get MachineName () : String

public function set MachineName (value : String)

Property Value

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

Exception typeCondition

ArgumentException

The MachineName is a null reference (Nothing in Visual Basic).

ArgumentException

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

MessageQueueException

An error occurred when accessing a Message Queuing method.

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

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);

// Set the queue's MachineName property value to the name of the local
// computer.
queue.set_MachineName(".");
// Display the new value of the queue's MachineName property.
Console.WriteLine("MessageQueue.MachineName: {0}", 
    queue.get_MachineName());

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2015 Microsoft