Jun 15, 2013

Debugging AIF services of Microsoft Dynamics AX 2012 in Visual Studio

Recently I came across a requirement for that I need to debug the standard AIF services. If we are using the AIF services in .NET application normally we cannot debug the logic inside the services. But there is a way to debug the AIF services. Follow the below listed steps to debug the AIF services.

Fist we need to do or make sure that the following listed settings..

Settings in Microsoft  Dynamics AX Server Configuration Utility:

1.   Go to Start à Administrative Tools à Microsoft Dynamics AX 2012 Server Configuration
2.   On the AOS machine turn debugging on in the server configuration utility by marking following      two checkboxes
a.  "Enable breakpoints to debug X++ code running on this server"
b.  “Enable global breakpoints”. 
3.   Click yes to restart the AOS.

Settings in Microsoft Dynamics AX Client Configuration Utility:

1.  Go to Start àAdministrative Tools à Microsoft Dynamics AX 2012 Configuration
2. On the client machine turn debugging on in the client configuration utility for the Business                   Connector.You can do this in the configuration utility by setting the Configuration Target drop down to Business Connector (non-interactive use only).

    Note: if the configuration in the client machine is original configuration it may not allows you to select the Business connector option, create a new configuration and make it as active so that it would allow you to choose the option 

Set Debugging Mode in AX client:

1. In AX go to Tools > Options > Development tab. Select  “When Breakpoint” in debugging mode option.



Changes in MS Visual Studio:

Do the following settings in .Net application. But these are not mandatory but recommended.

1.      Go to Tools à Options.
2.      Go to Debugging à General. Ensure the “Enable break point filter” option is selected.
3.      Go to symbols in the same window.
4.      Click on new folder icon on top right of the window.

Enter the path where all the Microsoft symbols stored, typically the path would be as shown below.

C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL

Enter the same path in the Cache symbols in the directory. The window would be as shown below.


Click on OK. 

Before debugging the AIF services do the following settings in visual studio:

1.      Open another instance of Visual Studio, Go to Tools àClick on Attach Process.
2.    A window will be open with all installed programs. Select AX32serv.exe as the process to debug and click on Attach.


3.      Open Application explorer and keep the put the break points in the appropriate classes.

      Note : We should not close this instance of Visual Studio where you did the attach process,just        minimize it and keep going on...  

4.      Switch to the visual studio instance where you are using AIf services and trying to debug.
      Start the debugging in Visual studio application then the debugger will automatically switched to AIF classes where you have kept the break point in another instance which you have minimized.

No comments: