Export (0) Print
Expand All

MessageQueue.GetMachineId Method

Gets the identifier of the computer on which the queue referenced by this MessageQueue is located.

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

public static Guid GetMachineId (
	string machineName
)
public static Guid GetMachineId (
	String machineName
)
public static function GetMachineId (
	machineName : String
) : Guid
Not applicable.

Parameters

machineName

The name of the computer that contains the queue, without the two preceding backslashes (\\).

Return Value

A Guid that represents a unique identifier for the computer on which the queue is located.

Exception typeCondition

MessageQueueException

The computer identifier could not be retrieved, possibly because the directory service is not available; for example, if you are working offline.

-or-

An error occurred when accessing a Message Queuing method.

You can use a computer's identifier for two purposes, among others: to read the computer journal and to set security certificates. However, you cannot call GetMachineId for a remote computer when you are working offline because the application must have access to the directory service on the domain controller.

The computer identifier (or machine identifier) is a Guid that Message Queuing creates when a computer is added to the enterprise. Message Queuing combines the computer identifier with the Machine and Journal keywords to create the machine journal's format name, which has the syntax Machine=<computeridentifier>;Journal. The machine journal, which is also known as the journal queue, is a system queue that stores copies of application-generated messages when the UseJournalQueue property is true.

This syntax for the journal is only valid when constructing the format name for the queue. The path name syntax is MachineName\Journal$.

The following table shows whether this method is available in various Workgroup modes.

Workgroup mode

Available

Local computer

No

Local computer and direct format name

No

Remote computer

No

Remote computer and direct format name

No

The following code example calls GetMachineId.

// Get the name of the computer that contains the queue.
string machineName = queue.MachineName;

// Display the return value of the MessageQueue.GetMachineId method.
Console.WriteLine("MessageQueue.GetMachineId(): {0}",
    MessageQueue.GetMachineId(machineName));

// Get the name of the computer that contains the queue.
String machineName = queue.get_MachineName();
// Display the return value of the MessageQueue.GetMachineId method.
Console.WriteLine("MessageQueue.GetMachineId(): {0}", 
    MessageQueue.GetMachineId(machineName));

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft