MessageQueue.GetMachineId(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取计算机的标识符,此 MessageQueue 引用的队列位于该计算机上。
public:
static Guid GetMachineId(System::String ^ machineName);
public static Guid GetMachineId (string machineName);
static member GetMachineId : string -> Guid
Public Shared Function GetMachineId (machineName As String) As Guid
参数
- machineName
- String
包含队列的计算机的名称,名称前不含两个反斜杠 (\\)。
返回
Guid,表示队列所在的计算机的唯一标识符。
例外
示例
下面的代码示例调用 GetMachineId(String)。
// 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));
注解
可以将计算机的标识符用于两个目的,等等:读取计算机日记并设置安全证书。 但是,脱机工作时无法调用 GetMachineId(String) 远程计算机,因为应用程序必须有权访问域控制器上的目录服务。
计算机标识符 (或计算机标识符) 是 Guid 将计算机添加到企业时创建的消息队列。 消息队列将计算机标识符与关键字Journal
组合在一起Machine
,以创建具有语法Machine=<computeridentifier>;Journal
的计算机日记格式名称。 计算机日志(也称为日记队列)是一个系统队列,用于在属性为true
时UseJournalQueue存储应用程序生成的消息的副本。
仅当构造队列的格式名称时,日志的此语法才有效。 路径名称语法为 MachineName
\Journal$
.
下表显示了此方法是否在各种工作组模式下可用。
工作组模式 | 可用 |
---|---|
本地计算机 | 否 |
本地计算机和直接格式名称 | 否 |
远程计算机 | 否 |
远程计算机和直接格式名称 | 否 |