Duplicate type with name ‘Dynamics.AX.Application…..’ in assembly ‘Dynamics.AX.Application,….’

March 13, 2018 Leave a comment

Bumped into this issue when we deployed a inbound port to a AIF website and the application pool keeps failing to stay in a started state.

Sample from the event view on the IIS server.

2018-03-13_125601

The cause of the issue seems to stem from using inheritance for the contracts that the deployed inbound ports utilize. It seems that the process that builds the application dll for the AIF website services does not handle this design pattern very well.

This is how my environment got to this state:

  • Existing inbound port A was already deployed and utilizes inheritance for its contract.
  • Developed a new inbound port B also uses inheritance and extends the same class as A (above).
  • Deployed the new inbound port B and incurred the failed state on IIS.

 

Even after removing the inheritance from inbound port B design the issue did not go away at the IIS level. It was like the IIS server had some how cached incorrect code, this code is leveraged for the build process of the application dll.

The solution is to delete the contents of the “work” folder in the AX AIF website folder location. My location is “C:\Program Files\Microsoft Dynamics AX\60\AifWebServices\Bin”, when reactivating the inbound port the contents of the “work” folder will be built again, this time it will have current code and thus successfully build a clean application dll for the hosted AX AIF webservices.

Keep in mind that there is a bit of a process here:

  • create backups (copy paste, do not rename as some folders might be shared) where needed
  • deactivate the inbound ports are deployed to the AIF website
  • delete the contents of the work folder
  • reactivate the inbound ports
  • check that the application pool stays in a started state
  • check event viewer for any additional errors
  • check IIS logs for 200 responses

 

Hope the above saves you some time 🙂

 

 

Categories: 2012 Tags: , ,

Stop Watch

July 19, 2017 Leave a comment

I have found that the following .NET function works rather nicely in AX2012.

System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
str getElapsedTime(System.Diagnostics.Stopwatch _stopwatch)
{

System.TimeSpan timeSpan = _stopWatch.get_Elapsed();
str timeStr;

if (CLRInterop::isNull(_stopWatch))
{

return ”;

}

timeStr = strFmt(“%1:%2:%3”, strRFix(strFmt(“%1”, CLRInterop::getAnyTypeForObject(timeSpan.get_Hours())) , 2, ‘0’),
strRFix(strFmt(“%1”, CLRInterop::getAnyTypeForObject(timeSpan.get_Minutes())), 2, ‘0’),
strRFix(strFmt(“%1”, CLRInterop::getAnyTypeForObject(timeSpan.get_Seconds())), 2, ‘0’));

return timeStr;

}

startLengthyOperation();

stopwatch.Start();
sleep(10000);
stopwatch.Stop();
info(strFmt(“1st Sleep: %1”,getElapsedTime(stopwatch)));

stopwatch.Restart();
sleep(6000);
stopwatch.Stop();
info(strFmt(“2nd Sleep: %1”,getElapsedTime(stopwatch)));

stopwatch.Start();
sleep(15000);
stopwatch.Stop();
info(strFmt(“2nd + 3nd Sleep: %1”,getElapsedTime(stopwatch)));

endLengthyOperation();
info(‘end’);

/*
//Out put message
1st Sleep: 00:00:10
2nd Sleep: 00:00:05
2nd + 3nd Sleep: 00:00:21
end
*/

 

For further reading:
https://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch(v=vs.110).aspx

Convert WorkerId to UserId

November 13, 2013 Leave a comment

If you would like to get the userId associated with a specific worker id the DirPersonUser table provides a useful method for this “worker2UserId” E.G.

userId = DirPersonUser::worker2UserId(MyHCMWorkerRecId);

AX 2012 – EventCUD (constant growth)

October 16, 2013 Leave a comment

Today’s topic is the EVENTCUD table, I have tried to explain some of the workings of the table and processes around it.

We had a situation where the EVENTCUD table in AX had over 2 million records and just kept on growing on a weekly basis.

After much analysis and trying to understand some very busy and in some places rather inefficient code, the cause was found. Before I get straight to the cause and solution, here is a little brief diatribe about how the EVENTCUD table works.

AX is setup to generate alerts for users, when the alert gets triggered a record is inserted into the EVENTCUD. This record will have a empty (null GUID) for a batchid value. When the change based alert job runs (manual / scheduled), it will then get the users per company from the EVENTCOMPANYRULE table and create new records in the EVENTCUD for the triggered event & then delete the original inserted line. (yip, 1 event = 1 EVENTCUD record x # of users per company (from EVENTCOMPANYRULE) = n EVENTCUD entries). Now these records in the EVENTCUD are process and tasks are created, in AX 2012 the task size is set to 100 events & a batchid is created & assigned to the records in the EVENTCUD table. When the change based alerts job is finished it will delete the EVENTCUD records and there will be new records in the EVENTINBOX where the user has been notified.

Worst case scenario:
i.e. 1 event = 1 EVENTCUD record => 1 EVENTCUD record x # of users/company (10) = 10 new EVENTCUD records & 1 delete original EVENTCUD record => 1 EVENTINBOX record is created

Now for the fun part!!!

When the changed based alerts job is ended unexpectedly, the records with assigned batchid are left behind in the EVENTCUD table. The batchid value is not reverted back to null GUID!, thus when the job runs again these records are not considered for processing, however these records will be looped over (while select statement – one of the inefficiencies) to find the records where the batchid = ‘00000000-0000-0000-0000-000000000000’ so that it can assign them a new GUID and start generating the alerts for the users (EVENTINBOX).

Solution:
Even though we tried what is called a graceful shutdown of the AOS’s, if the changed based alerts  batch job is running the situation above can happen. So double check that the job is either in status “withhold / ended“. We ended up truncating our table to resume BAU functionality in regards to alerts being generated & sent out of AX.

Partner based improvement to code:

  • Resolve some of the inefficient code to make sure that some of the while statements are accurate and optimal
  • Create some form of clean up job / task to delete old entries in the EVENTCUD table that have batchid’s with a createddatetime greater than our threshold (7 days)
  • Update EVENTCUD records to have a null GUID for a batchid value where the records fall in the threshold (7 days)

 

Hope you have found the above informative.

Categories: 2012 Tags: ,

Change the AOS service account in AX2012

January 1, 2013 Leave a comment

I have been rather busy in managing environments lately, moving databases backwards from PROD to UAT etc. Due to using different service accounts for the different environments  I have started to find that it can be rather cumbersome trying to update everything that needs updating.

From Microsoft AX Support blog , I found a guide & sql script to help out with the task of changing the AOS service account on a DB / Environment .

NOTE: read the guide carefully, you might not need to do everything that has been outlined.

Categories: 2012, Dynamics AX

The Year is 2013

January 1, 2013 Leave a comment

Hello World 🙂 , Happy New Year!….

yip, it is 2013.
Here is wishing all of you a wonderful year.

Thank you for reading our posts through 2012.

 

Cheers

Categories: Uncategorized

AX2012 Help Files – Multiple pages pointing to the same Microsoft.Help.F1 topic

November 5, 2012 Leave a comment

I’ve been trying to create a help page similar to the landing page that you get when you press F1 from the Purchase Requisitions Details form. This page has two links on it, one to the PurchReq Line Form help page and the second to the Purch Req Header Form. 

Initially (for my form) I tried to create this contents page manually, but after some investigation into how the Purch Req Help page works I discovered that if you simply specify the same Microsoft.Help.F1 id for multiple pages, the system will automatically create this contents page for you.

e.g. Header HelpPage <meta name=”Microsoft.Help.F1″ content=”Forms.MyForm” />
Line HelpPage <meta name=”Microsoft.Help.F1″ content=”Forms.MyForm” />

Best Practice Fixes #1: No control was found matching the expected node ‘LineDetailsTabs’.

July 4, 2012 1 comment

I’m currently working through best practice checks required for Product certification and will be posting fixes / suggestions on how to resolve some of these checks as I come across them.

The first one is the error: No control was found matching the expected node ‘LineDetailsTabs’.

Although I don’t have an exact resolution to this issue, the root cause is the Design Style that you are using for your form. One can find the style used by navigating to your form in the AOT, then selecting the Designs -> Design Node, right click, click properties and view the ‘Style’ property.

I had mine mistakenly set to ‘DetailsFormTransaction’ instead of ‘DetailsFormMaster’. Changing this fixed a number of my Best practice errors.

You can view the Templates for Form styles under the Forms Node in the AOT, they are the forms that start with SysBPStyle_*

Renaming the description of number sequence entries in AX2012

May 15, 2012 3 comments

The number sequence wizard lack some imagination when it comes to assigning a description to number sequences. Here is some code to help you get more meaningful descriptions.

Categories: Uncategorized

Number Sequences Wizard in AX2012

May 14, 2012 Leave a comment

Something that I have stumbled into and over in the last little while is the sequence of setting up a new system in regards to number sequences. I know that many of you might think, just run the wizard. Yes, it is as simple as that but what I never picked up on before is the following:

  • If you have not configured (license configuration) your system, the wizard will only create the base number sequences. It will not create ones for where the system has not been configured. (yeah I know pretty logical)

So here is general rule of thumb for those of you that have fallen into a similar (unobservant) trap.

New installs:

  • Configure your system 1st and then use the wizard to create your number sequences.
System Updates:
  • Rerun the wizard after you have made a configuration change.
I will post more on how to rename the descriptions of Number Sequences as the wizard is lacking in this regard.

 

 

Categories: Dynamics AX