As part of the Dynamics AX Health Check service that we offer, we review the Microsoft Dynamics event log messages. There is a lot of useful information that can be harvested from these logs. I have a PowerShell script that captures the messages on all the servers we review and writes the events into a .csv file for reviewing in Excel. An issue that I’ve noticed on a few clients that I’ve performed Health Checks on were that some of the event messages for the Microsoft Dynamics AX provider were missing. You may have seen this in your own event logs before where <Event ID> varies:
“The description for Event ID <Event ID> from source Microsoft Dynamics AX cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.”
This has been a thorn in my side for a while as the Get-WinEvent cmdlet I use in my PowerShell script wasn’t returning any messages for this event. Here is an example from the .csv file that my script creates and as you can see the Type and Message columns are blank:
When the events are properly populated this is what it would normally look like (message truncated for brevity):
Initially I set out in PowerShell to get around this annoyance. What I learned was rather interesting if not frustrating. If I changed my script to use the Get-EventLog cmdlet, it returned the message:
“Microsoft Dynamics AX Business Connector Session 7.
Could not load assembly ‘TillLayoutDesigner, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies.”
The problem with this approach however is that Get-EventLog doesn’t have the ability to return Critical events like Get-WinEvent does among other things. Overall Get-WinEvent log is better (IMHO) which you can read more about here if interested – http://blogs.msdn.com/b/powershell/archive/2009/06/11/windows-event-log-in-powershell-part-ii.aspx. Also, since I already had it in my script, I didn’t want to make a lot of edits so I decided to investigate this further and see if I could resolve the error so that the information was correctly populated. It wasn’t missing per se as if you check on the Details tab you could get the information from there:
I did some research on the Windows Event Log to get a little more background on how it works. This link Windows Event Log was very informative although I did have to click around on a lot of different links to piece together a full understanding.
In a nutshell what I gathered was:
- Applications don’t log event messages directly to the event log
- Applications use event message Files
- The event message file contains a list of the events with place holders that the application populates
- Event message files are either contained in a .dll or in the application .exe
For example Dynamics AX would log a message to the Windows Event Viewer like this if it was written in C# (it most likely ties into some .Net framework assembly but I didn’t want to figure that out):
EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Informational, 193);
Notice that the event message (Microsoft Dynamics AX Business Connector Session 7. Could not load assembly ‘TillLayoutDesigner, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies) is not included.
An event message file would look something like this, which I grabbed from https://msdn.microsoft.com/en-us/library/windows/desktop/dd996906(v=vs.85).aspx:
You have chosen an incorrect command.
<Japanese message string goes here>
I figured I was left with the following possibilities:
- The event message file was missing for the Microsoft Dynamics AX
- The event message file was incorrectly/not configured for the Microsoft Dynamics AX provider.
I didn’t know what event message file Dynamics uses so I went to the registry to figure it out. I went to the Application Event log to review the Microsoft Dynamics AX provider log and was surprised to find it didn’t exist! The event log location is: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application and as you can see below, there isn’t a Microsoft Dynamics AX provider.
I looked at the other Dynamics providers to get a feel for their structure:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Dynamics .NET Business Connector 6.0
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Dynamics AX Services
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Dynamics AX Services (IIS)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Dynamics Server 01
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Microsoft Dynamics AX – AXUtil
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Microsoft Dynamics AX Services Client
Notice there were 4 different event message files being used (there may be others, this is just what I observed)
1. AX32.exe for the client
2. EventLogMessages.dll for AX Services
3. AX32serv.exe for the server
4. Microsoft.Dynamics.BusinessConnectorNet.dll for the business connector
I figured the reason for the message, “The description for Event ID 193 from source Microsoft Dynamics AX cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer,” was that there wasn’t a provider in the event log registry listed. I don’t know how it was managing to provide the message information it was, I’m just assuming there is a default message file it falls back on. I also didn’t know which message file to use so I played around in my environment to figure it out.
I first tried to fix the issue by using the C:\Windows\Microsoft.NET\Framework64\v2.0.50727\EventLogMessages.dll message file. This is initially what I did:
- Create a new key under the Application log – HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Microsoft Dynamics AX
- Create a new String Value property with the name of EventMessageFile
- Populate the EventMessageFile property with the value of C:\Windows\Microsoft.NET\Framework64\v2.0.50727\EventLogMessages.dll
It looked like this:
As soon as I created this key and went back to the event viewer (after refresh) the error was gone and the part of the text was there.
I noticed that the error message wasn’t appearing completely as when I viewed the details tab I saw all of the error message:
I decided to change the EventMessageFile property from:
to the following:
C:\Program Files (x86)\Microsoft Dynamics AX\60\\Client\Bin\Ax32.exe
The key/value looked like this now:
SUCCESS! When I refreshed event viewer again, this is what I saw:
The only remaining thing I have left to do is to update my script to check for this missing key and populate it if it is missing. This way I won’t have to worry about missing the error messages anymore! I do admit I am still pondering how this came about but since I’ve seen this issue at so many clients I’m left to believe it’s some type of Dynamics bug. Figuring out the root cause sounds like an idea for another blog.
I hope you enjoyed and found this helpful!