Citrix:为什么 XASession.ClientAddress 为空?
Citrix: Why is the XASession.ClientAddress Null?
using Citrix.Common.Sdk;
using Citrix.XenApp.Sdk;
using Citrix.XenApp.Commands;
using Citrix.Management.Automation;
我正在尝试将客户端地址放入数组中以添加到列表中。问题是 ClientAddress 在我测试时一直返回 null。我可以看到在线用户,他们的客户端地址在 App Center 中可见。返回 ServerName 没有问题。有人知道为什么 ClientAddress 不起作用吗?
private List<string[]> findUser(string strUser)
{
List<string[]> list = new List<string[]>();
GetXASessionByFarm sessions = new GetXASessionByFarm(true);
foreach (XASession session in CitrixRunspaceFactory.DefaultRunspace.ExecuteCommand(sessions))
{
if (session.AccountName == objWINS + "\" + strUser)
{
string[] result = new string[3];
result[0] = strUser;
result[1] = session.ServerName; //This is working, it comes back with the server name.
result[2] = session.ClientAddress; //This isn't working, it comes back blank.
MessageBox.Show(result[2]);
list.Add(result);
}
}
return list;
}
这个问题的答案是在声明 GetXASessionByFarm 之后添加以下行:
sessions.Full = true;
例如:
private List<string[]> findUser(string strUser)
{
List<string[]> list = new List<string[]>();
GetXASessionByFarm sessions = new GetXASessionByFarm(true);
sessions.Full = true;
foreach (XASession session in CitrixRunspaceFactory.DefaultRunspace.ExecuteCommand(sessions))
{
if (session.AccountName == objWINS + "\" + strUser)
{
string[] result = new string[3];
result[0] = strUser;
result[1] = session.ServerName; //This is working, it comes back with the server name.
result[2] = session.ClientAddress; //This isn't working, it comes back blank.
MessageBox.Show(result[2]);
list.Add(result);
}
}
return list;
}
这是因为默认情况下命令没有return全部信息。我不得不翻译它并根据 Get-XASessions powershell 命令做一些猜测。当我自己解决问题时,这种感觉总是很好。显然,我在这个软件开发领域处于狂野西部边界的边缘。没有人这样做。
using Citrix.Common.Sdk;
using Citrix.XenApp.Sdk;
using Citrix.XenApp.Commands;
using Citrix.Management.Automation;
我正在尝试将客户端地址放入数组中以添加到列表中。问题是 ClientAddress 在我测试时一直返回 null。我可以看到在线用户,他们的客户端地址在 App Center 中可见。返回 ServerName 没有问题。有人知道为什么 ClientAddress 不起作用吗?
private List<string[]> findUser(string strUser)
{
List<string[]> list = new List<string[]>();
GetXASessionByFarm sessions = new GetXASessionByFarm(true);
foreach (XASession session in CitrixRunspaceFactory.DefaultRunspace.ExecuteCommand(sessions))
{
if (session.AccountName == objWINS + "\" + strUser)
{
string[] result = new string[3];
result[0] = strUser;
result[1] = session.ServerName; //This is working, it comes back with the server name.
result[2] = session.ClientAddress; //This isn't working, it comes back blank.
MessageBox.Show(result[2]);
list.Add(result);
}
}
return list;
}
这个问题的答案是在声明 GetXASessionByFarm 之后添加以下行:
sessions.Full = true;
例如:
private List<string[]> findUser(string strUser)
{
List<string[]> list = new List<string[]>();
GetXASessionByFarm sessions = new GetXASessionByFarm(true);
sessions.Full = true;
foreach (XASession session in CitrixRunspaceFactory.DefaultRunspace.ExecuteCommand(sessions))
{
if (session.AccountName == objWINS + "\" + strUser)
{
string[] result = new string[3];
result[0] = strUser;
result[1] = session.ServerName; //This is working, it comes back with the server name.
result[2] = session.ClientAddress; //This isn't working, it comes back blank.
MessageBox.Show(result[2]);
list.Add(result);
}
}
return list;
}
这是因为默认情况下命令没有return全部信息。我不得不翻译它并根据 Get-XASessions powershell 命令做一些猜测。当我自己解决问题时,这种感觉总是很好。显然,我在这个软件开发领域处于狂野西部边界的边缘。没有人这样做。