简体   繁体   English

如何在 Citrix XenApp 6.0 上获得唯一的客户端 ID? (来自 4.0 和 4.5 的 MFCom 不起作用)

[英]How do you get a unique client ID on Citrix XenApp 6.0? (MFCom from 4.0 and 4.5 doesn't work)

Currently for Presentation Server 4.0 and 4.5, I am getting the unique client ID via MFCom in C# .NET.目前对于 Presentation Server 4.0 和 4.5,我正在通过 MFCom 在 C# .NET 中获取唯一的客户端 ID。

MetaFrameFarm farm = new MetaFrameFarm();
farm.Initialize(MetaFrameObjectType.MetaFrameWinFarmObject);

foreach (MetaFrameSession session in farm.Sessions)
{
    clientId = session.ClientID;
.....

I began to get an error testing on 6.0.我开始在 6.0 上进行错误测试。 The line in question that is failing is the first line to instantiate a the object 'farm' above.有问题的行是实例化上述 object 'farm' 的第一行。

Looking online I found this...上网查了一下,发现这个...

Starting in XenApp 6.0, MFCOM as a publically supported programming and scripting interface will no longer be available.从 XenApp 6.0 开始,MFCOM 作为公共支持的编程和脚本接口将不再可用。 All existing MFCOM-based code no longer works on XenApp 6.0.所有现有的基于 MFCOM 的代码不再适用于 XenApp 6.0。 No doubt that the absence of MFCOM will be something that requires additional effort to the adoption of XenApp 6.0.毫无疑问,没有 MFCOM 将需要额外的努力才能采用 XenApp 6.0。

Is there a way to get a unique client ID in 6.0?有没有办法在 6.0 中获得唯一的客户端 ID?

This is pretty old, but I kept coming across this when I wanted to get a clientID.这已经很老了,但是当我想获得 clientID 时,我一直在遇到这个问题。

Keep in mind the ClientIDs from 4.X don't appear to be the same format for 6.X.请记住,来自 4.X 的 ClientID 似乎与 6.X 的格式不同。 This goes for about all the IDs, App and Server:这适用于所有 ID、应用程序和服务器:

Runspace rs = RunspaceFactory.CreateRunspace();
rs.Open();

PowerShell ps = PowerShell.Create();
ps.Runspace = rs;

PSSnapInException ex;
rs.RunspaceConfiguration.AddPSSnapIn("Citrix.XenApp.Commands", out ex);

ps.AddCommand("GET-XASession").AddParameter("Full");

foreach (PSObject Session in ps.Invoke())
{
   try
   {
      ClientID = Convert.ToString(Session.Properties["ClientId"].Value);

      Console.WrileLine(ClientID);

   }

   catch (Exception e)
   {
      WriteError.WriteEntry("Client Failure " + e.Message + EventLogEntryType.FailureAudit);
   }
}

As you've correctly established, MFCOM is not available on XenApp 6. So, you're left with two ways of getting a unique ClientID:正如您正确建立的那样,MFCOM 在 XenApp 6 上不可用。因此,您有两种获取唯一 ClientID 的方法:

  1. Use the Citrix WMI subsystem.使用 Citrix WMI 子系统。 From within your application, connect to the Root\Citrix WMI namespace and enumerate instances of the MetaFrame_Session class.从您的应用程序中,连接到 Root\Citrix WMI 命名空间并枚举 MetaFrame_Session class 的实例。 You can filter by server name (as the enumeration will return all sessions on all farm servers, not just the one you're running the application on) and session ID.您可以按服务器名称(因为枚举将返回所有场服务器上的所有会话,而不仅仅是您正在运行应用程序的那个)和 session ID 进行过滤。 The instances of the Metaframe_session class contain a couple of properties which are references to instances of other classes; Metaframe_session class 的实例包含几个属性,它们是对其他类实例的引用; the Client property references Metaframe_ICA_Client and the SessionUser property references Citrix_User. Client 属性引用 Metaframe_ICA_Client,SessionUser 属性引用 Citrix_User。 Metaframe_ICA_Client gives you the client's IP address, hostname and a few other things you could combine as an ID. Metaframe_ICA_Client 为您提供客户端的 IP 地址、主机名和其他一些您可以组合为 ID 的内容。
    However, currently XenApp 6 has a massive bug with the Citrix WMI subsystem and attempting to enumerate and instantiate the classes I've references above (as a normal user - admins are fine) results in no less than fifteen separate system services crashing... So maybe not.然而,目前 XenApp 6 的 Citrix WMI 子系统存在一个巨大的错误,并且尝试枚举和实例化我上面引用的类(作为普通用户 - 管理员很好)导致不少于十五个单独的系统服务崩溃......所以也许不是。
  2. The alternative (and the technique I employed) was to use the Citrix WFAPI SDK .另一种方法(以及我采用的技术)是使用Citrix WFAPI SDK It's unmanaged code and a bit of a pig, but there's a pretty good article on using WFAPI to grab client details here .这是非托管代码,有点像猪,但是这里有一篇关于使用 WFAPI 获取客户端详细信息的非常好的文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM