RSS

Tag Archives: aos

How to connect to a specific AOS in a load balanced environment

ISSUE:
In a load balanced, clustered environment. Occasionally, i would like to connect to a specific AOS for troubleshooting purposes.

SOLUTION:
We can use command line to connect.
Syntax: AX32.exe -loadbalance=0 -aos2=YOURAOSNAME:YOURPORT

How to find YOUR AOS NAME:
image

How to find your PORT:
Go to AX Server Configuration Utility

image

 

Tags: , , , , , ,

AOS takes a long time to start

Problem:

When you start an AOS, you may notice it takes a very long time before the service gets the status “Started”. A possible cause is left-over data in SysClientSession table. When starting up, the AOS seems to check if the client is still around.  The SysClientSessions contains the data for the client sessions that are currently active in the system.

Solution:

1. Shut down AOS for sing instance or all AOSes for multiple instances (not an ideal way in Production)

2. Use SQL Server Management Studio and run this sql

SELECT        SESSIONID, SERVERID, VERSION, LOGINDATETIME, LOGINDATETIMETZID, STATUS, USERID, SID, USERLANGUAGE, HELPLANGUAGE, CLIENTTYPE,
SESSIONTYPE, CLIENTCOMPUTER, DATAPARTITION, RECVERSION, RECID
FROM            SYSCLIENTSESSIONS

image

3. Delete all client records

4. Restart AOS(es)

 

Tags: , ,

Effective way to resolve all weird issues caused by users’ cache

I found these steps below are very effective to clear up weird issues after code/data migration or when users start experiencing wacky behaviors

STEP 1: Run the job below

public server static void FlushAll(Args _args)
{
   Args args;
  
   // Leave the "args" as null will skip the info messages normally shown when using menu items.
   SysFlushAOD::main(args);
   SysFlushData::main(args);
   SysFlushDictionary::main(args);

}

STEP 2: Delete user cache

Method 1:

  1. STOP AOS
  2. Log on to TS where all users use to connect to AX
  3. Search of *.AUC files and delete all these files
  4. Restart AOS

Method 2:

  1. Run this job on TS where all users use to connect to AX.
static void ClearAucFileForUsers(Args _args)
{
    System.Array    files;
    int             fileCount;
    int             i;
    str             nextFile;
    str             path = "C:\\Users";
    str             Finalpath;
    str             pattern = "*.auc";
    container       listOfFiles;
    int             DirCount;
   
   
    System.Array    Directories;
    int             j;
    str             nextDir;
    container       listOfDir;
   
    FileIOPermission    dirPermission, filePermission;
    InteropPermission   interopPermission;
    Set                 permissionSet;
   
    new InteropPermission(InteropKind::ClrInterop).assert();
    listOfDir = conNull();
    listOfFiles     = connull();
   
    Directories = System.IO.Directory::GetDirectories(path);
    if(Directories)
    {
        DirCount = Directories.get_Length();
       
        for(j=0; j < DirCount; j++)
        {
            nextDir    = Directories.GetValue(j);
            Finalpath = nextDir + "\\AppData\\Local";
            listOfDir += Finalpath;
        }       
    }
    j=0;
    DirCount = conLen(listOfDir);
    while( j < conLen(listOfDir))
    {
        j++;
        Finalpath = conPeek(listOfDir,j);
        try           
        {
            files           = System.IO.Directory::GetFiles(Finalpath, pattern);
        }
        catch
        {
            continue;   
        }
        if (files)
        {
            fileCount =    files.get_Length();
           
            for(i=0; i < fileCount; i++)
            {
                nextFile    = files.GetValue(i);
                System.IO.File::Delete(nextFile);       
                info(nextFile);
            }
        }
    }
   
    CodeAccessPermission::revertAssert();
}
  1. Stop and Restart AOS

STEP 3: Delete SysLastValue

static void DeleteAllLastValue(Args _args)
{
    SysLastValue syslastValue;   
   
     ttsBegin;
     delete_from syslastValue;
     ttsCommit;   
}
 
 

Tags: , , , , ,

How to flush AOS cache form code

Flush the AOS cache from code

Under Menu items > Action, duplicate all these 3 menu item actions and three menu action items that can be used to flush system data, the AOD, and dictionary
1. SysFlushAOD
2. SysFlushData
3. SysFlushDictionary

Duplicate these 3 menu action items and give them a new name

image

These three are running on “Called From” which when we run it on client side, it will clear client cache. We need to be able to clear AOD, sys data and dictionary and cause a refresh, therefore, we need to change it to “Server”

Go to RunOn property and change it from “Run-On” to “Server”

image

Now, start run each menu action item one by one.

static void DevClearCache(Args _args)
{
#define.FlushAOD(“DevSysFlushAOD”)                  // replace with your own menuitem name
#define.FlushData(“DevSysFlushData”)                // replace with your own menuitem name
#define.FlushDictionary(“DevSysFlushDictionary”)    // replace with your own menuitem name
Args args = new Args();
MenuFunction mf;

// Flush AOD
mf = new MenuFunction(menuitemActionStr(#FlushAOD), MenuItemType::Action);
mf.run(args);

// Flush Data
mf = new MenuFunction(menuitemActionStr(#FlushData), MenuItemType::Action);
mf.run(args);
info(“Data has been refreshed”);

// Flush Dictionary
mf = new MenuFunction(menuitemActionStr(#FlushDictionary), MenuItemType::Action);
mf.run(args);
}

You can download the entire project here.

 
2 Comments

Posted by on December 11, 2013 in Development

 

Tags: , , , , , ,

AOS Environment Name in Developer Workspace

One of my colleagues found this interesting piece of information today and I would like to share

Often when we want to see what AOS we are connected to we turn on ‘Show AOS Name’ in Tools->Options->Status Bar.

clip_image001

Then we see the AOS Name in the status bar:

clip_image002

The only problem is that is not necessarily the AOS name.  This is just the name given to the AOS in the config file (.axc).  If we look at the .axc in notepad there is a line for this name and we can change it here:

clip_image005

And see the change in the AX status bar:

clip_image006

So if the .axc was created incorrectly using the status bar to identify the AOS could be dangerous.  It would probably be a better idea to always check the port number in the .axc file and compare it to the configurations listed in the server configuration utility.

 
 

Tags: , , ,

 
%d bloggers like this: