Thursday, 5 April 2018

Access error in batch jobs/printing of reports

Recently we had production machines operating system patched. After the patching, we had a production deployment of new code. When the AOS were brought back up, some of the application processes started throwing errors. These included AIF/workflow batch jobs, printing of some reports etc. The error message was as follows


Infolog for job AIF (5641187121)
Infolog for task AifInboundProcessingService (5651730951)
Cannot read a record in AifResponse (AifResponse).
The corresponding AOS validation failed.
AifInboundProcessingService-run
Microsoft.Dynamics.Ax.Xpp.ErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ErrorException' was thrown.
   at Microsoft.Dynamics.Ax.MSIL.Interop.throwException(Int32 ExceptionValue)
   at Microsoft.Dynamics.Ax.MSIL.cqlCursorIL.DeleteAll(IntPtr table)
   at Dynamics.Ax.Application.AifResponse.deleteExpiredResponses() in AifResponse.deleteExpiredResponses.xpp:line 7
   at Dynamics.Ax.Application.AifInboundProcessingService.Run() in AifInboundProcessingService.run.xpp:line 35
   at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54
   at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13
   at BatchRun::runJobStatic(Object[] )
   at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
   at BatchIL.taskThreadEntry(Object threadArg)
Infolog for task AifGatewayReceiveService (5651730959)
Cannot create a record in Gateway queue (AifGatewayQueue).
The corresponding AOS validation failed.
Cannot create a record in Gateway queue (AifGatewayQueue).
The corresponding AOS validation failed.
Cannot create a record in Gateway queue (AifGatewayQueue).
The corresponding AOS validation failed.
Cannot create a record in Gateway queue (AifGatewayQueue).
The corresponding AOS validation failed.
Cannot create a record in Gateway queue (AifGatewayQueue).
The corresponding AOS validation failed.


Infolog for job Workflow message processing (5641359370)
Infolog for task Workflow message processing task (5652234909)
User 'BatchUser' is not authorized to update a record in table 'SYSWORKFLOWTABLE'. Request denied.
Cannot edit a record in SysWorkflowTable (SysWorkflowTable).
Access Denied: You do not have sufficient authorization to modify data in database.
User 'BatchUser' is not authorized to update a record in table 'SYSWORKFLOWTABLE'. Request denied.
Cannot edit a record in SysWorkflowTable (SysWorkflowTable).
Access Denied: You do not have sufficient authorization to modify data in database.
SysWorkflowQueue-activate
SysWorkflow-lock
SysWorkflow-fault
SysWorkflow-internalFault
SysWorkflow-faultWorkflowInstance
Microsoft.Dynamics.Ax.Xpp.ErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ErrorException' was thrown.
   at Microsoft.Dynamics.Ax.MSIL.Interop.throwException(Int32 ExceptionValue)
   at Microsoft.Dynamics.Ax.MSIL.cqlCursorIL.update(IntPtr table)
   at Dynamics.Ax.Application.SysWorkflow.faultWorkflowInstance(SysWorkflowTable _workflowTable, String _user, String _faultMessage) in SysWorkflow.faultWorkflowInstance.xpp:line 66
   at Dynamics.Ax.Application.SysWorkflow.internalFault(WorkflowContext _workflowContext, String _user, String _faultMessage) in SysWorkflow.internalFault.xpp:line 56
   at Dynamics.Ax.Application.SysWorkflow.fault(WorkflowContext _workflowContext, String _user, String _faultMessage) in SysWorkflow.fault.xpp:line 32
   at Dynamics.Ax.Application.SysWorkflowQueue.dispatch(Guid _affinity) in SysWorkflowQueue.dispatch.xpp:line 185
   at Dynamics.Ax.Application.SysWorkflowQueueTask.Run() in SysWorkflowQueueTask.run.xpp:line 13
   at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54
   at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13
   at BatchRun::runJobStatic(Object[] )
   at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
   at BatchIL.taskThreadEntry(Object threadArg)


The error message showed that user does not have access to the tables. However even granting System Administrator was not fixing the issue. The only workaround we could find was to deactivate an AIF port. This somehow fixed the issue.


We opened a case with Microsoft and solution provided by MS engineer was to make sure that the SID in the following registry key was that of the account running AOS service. In our case the SID was that of the user who installed the AOS on these machines.


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dynamics\6.0\Setup\Dynamics Server\setupuser




After changing the registry key on all AOS (while the AOS service was not running), the error disappeared. Please take a backup before modifying registry.


This posting is provided "AS IS" with no warranties. Use code at your own risk.

Saturday, 24 March 2018

BizTalk Server Application Configuration - SSO database export file enctyption/decryption

While working on AX integration using BizTalk, a requirement arose to save some of the configuration data. There are several options available as described in this article.


We decided to store the configuration in the SSO database. While the MMC snap-in provided by Microsoft is good enough, there is no option to bulk edit the Key/Value pairs stored in the SSO database. The snap-in does allow to export the file, but it encrypted and hence cannot be edited outside of the snap-in.


We wrote a small utility which allows to decrypt/encrypt the files exportable from the snap-in. Once exported, the file can be decrypted, edited in a text editor, encrypted again and can be imported in the snap-in to create the key/value pairs in the SSO database.




The utility can be downloaded from here.


This posting is provided "AS IS" with no warranties. Use code at your own risk.

Tuesday, 20 February 2018

Synchronization error due to SQL Plan Guides



Recently we had to create a plan guide in SQL Server (not a good long term solution). Everything seemed to be working fine until we had a production deployment and the database synchronization failed as shown in the screenshot below.




It seems that during synchronization a store procedure is recreated. As our plan guide was based on queries in the stored procedure, AX was unable to drop it. Only solution was to drop the plan guide (disabling the plan guide did not help) and re-create it after the synchronization.


This posting is provided "AS IS" with no warranties. Use code at your own risk.

Sunday, 31 December 2017

SSL/TLS error when calling a web service

For one of our integrations we received the following error when it was enabled in production.

Could not establish secure channel for SSL/TLS with authority ''.

The web service requires some certificates to be installed which were correctly installed. The web service was working fine on development machines. Initial investigation did not find anything different between the development/production systems. We then traced the web service calls using Fiddler on both development and production machines and that's when we found out that the number of ciphers are different on both environment. Production did not had the ciphers highlighted below.


A quick search on internet pointed towards a windows KB (3172614) which adds new ciphers. Installing the KB fixed the issue.

Note: The KB requires restart of the machine.

This posting is provided "AS IS" with no warranties. Use code at your own risk.

Thursday, 21 December 2017

Error "Data at the root level is invalid" when opening a report

Recently users reported that they receive an error when opening a particular report. The error is

"Data at the root level is invalid. Line 1, position 1."

The call stack of the error is



Even opening the report in Visual Studio was throwing the same error as shown below.


We exported the report from the AOT and analysed it ina text editor. It turned out that there was a CU/KB applied and the report was part of it. However the report was never upgrade and it had comments from the code upgrade tool. Fixing these comments in text editor, re-importing the report in to AX and deploying it fixed the issue.



This posting is provided "AS IS" with no warranties. Use code at your own risk.