AX 2012 - 在 X++ 中获取实例名称而不是服务器名称 [英] AX 2012 - Get Instance Name not Server Name in X++

查看:44
本文介绍了AX 2012 - 在 X++ 中获取实例名称而不是服务器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 X++ 中获取实例名称而不是服务器名称?

所附图片显示了我正在寻找的字段:

当我使用 xSession.AOSName(); 时它返回服务器名称,当我使用 sysServerSessions..Instance_Name; 时返回一个空字符串.Instance_Name 字段在数据库中只有01",所以如果它确实返回了一个值,它仍然是不正确的.

解决方案

Instance name (optional),我相信只是文件夹名称和服务显示名称.因此,当您创建多个实例时,它会创建一个文件夹 C:\Program Files\Microsoft Dynamics AX\60\Server\[InstanceName]\,然后创建一个具有该实例显示名称的 AOS 服务.>

如果你真的想要它,你可以枚举文件夹并使用正则表达式或任意数量的其他方法解析它.要枚举文件夹,请在某处创建此 server 静态方法并调用它:

静态服务器文件名打开路径Server(){返回 xInfo::directory(DirectoryType::Bin);}

还有一个ServerId,我认为它和Instance Name 不一样,但它在SysServerConfig 表中:

while select sysServerConfig{info(strFmt("%1", sysServerConfig.ServerId));}

ServerId 是从 AOSId 和名称等派生的值.您可以在此方法中看到它是如何派生的:\Data Dictionary\Tables\SysServerConfig\Methods\delete

Is it possible to get the Instance Name instead of the Server Name in X++?

The attached image shows the field I am looking for:

When I use xSession.AOSName(); it returns the Server Name and when I use sysServerSessions..Instance_Name; an empty string is returned. The Instance_Name field only has "01" in the database so it would still be incorrect if it did return a value.

解决方案

The Instance name (optional), I believe is just the folder name and the service display name. So when you create multiple instances, it creates a folder C:\Program Files\Microsoft Dynamics AX\60\Server\[InstanceName]\, and then an AOS service with that instance display name.

If you really want it, you could enumerate the folder and parse it using a regular expression or any number of other methods. To enumerate the folder, create this server static method somewhere and call it:

static server FilenameOpen pathServer()
{
    return xInfo::directory(DirectoryType::Bin);
}

There is also a ServerId, which I don't think is the same as the Instance Name, but it's in the SysServerConfig table:

while select sysServerConfig
{
    info(strFmt("%1", sysServerConfig.ServerId));
}

And the ServerId is a derived value from the AOSId and name, etc. You can see how it's derived in this method: \Data Dictionary\Tables\SysServerConfig\Methods\delete

这篇关于AX 2012 - 在 X++ 中获取实例名称而不是服务器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆