MessageQueue.MachineName Property
Gets or sets the name of the computer where the Message Queuing queue is located.
Assembly: System.Messaging (in System.Messaging.dll)
| Exception | Condition |
|---|---|
| ArgumentException |
The MachineName is null. |
| 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 |
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.