Debugging AIF on Windows 2008
For those who are using Windows 2008 as server platform and want to debug the Dynamics 2009 AIF… this will help!
We are using AIF WCF web services to communicate between a .NET portal and Dynamics Ax. And while developing we were unable to debug the code running in the Business Connector. Since we were able to do this on other customer sites I started coparing the infrastructure and the only difference was the fact that we were using Windows 2008 instead of Windows 2003…
I followed the usual steps to be able to debug the AIF code which I will elaborate in this post later on, but no success. I contacted the Microsoft support and they soon informed me about the fact that debugging the Business Connector on a Windows 2008 system is indeed a well known issue with for them! So there you have it, problem identified!
Two weeks later I was surprised as the support engineer contacted me about this issue and told me that they had a hot fix developed for this! (The thing was more like a kernel rollup since the kernel build number was already past the KR5 build number)
So to be able to debug, the first thing to do is to install the hot fix known as KB2251040 (I haven’t found this yet on the partner source knowledge base, but for those who need it, you can contact support to request this hot fix)
Installing the update
Run the update provided and you will eventually see the following screen where the installer checks the already installed parts.

Important: This update needs to be installed on all the machines if they are distributed on multiple physical servers. (In our case we updated the AOS / components on one box, and also the Business Connector on the IIS box)
Next the installer will ask you if you want to install the update on all instances of the AOS or select a specific one.

After the installer has finished, you will see the following file versions of the business connector:
| Location | FileName | Version | Filesize |
| Business Connector bin directory | AxCliCfg.exe | 5.0.1500.3076 | 374 kb |
| Business Connector bin directory | Microsoft.Dynamics.BusinessConnectorNet.dll | 5.0.1500.3076 | 13910 kb |
There are several other files updated in the serverbin directory and in the clientbin but all should have the 5.0.1500.3076 version number. The list will also be complete when the KB article appears on partner source.
Steps to debug the AIF
Now that we have updated all of the components to work on the Windows 2008 platform, we can start worrying about the debugging itself. Several steps need to be taken into account to be able to debug, so let’s start.
Modify the AIFInboundProcessingService class
Firstly, imho the most important first so we do not forget this. There is method called runAsWrapper that we need to modify so that the runAs statement will not be used to run the message. Modify this so it matches the picture below.

Modify the client configuration
Open the client configuration tool and go to the developer tab. There you can check both checkboxes to enable the breakpoints in the business connector.

Modify the server configuration
Same thing on the server side. On the Application Object Server tab, make sure the checkboxes are enabled and restart the AOS service if needed.

Determine the Dynamics Ax user and enable debug mode for the user
Also very important is to set breakpoint with the right user. The user that runs the business connector will be used for setting breakpoint, etc..
This user will be specified when the logon call is used in the business connector. So make sure you debug with that user credential.
To enable debugging, open a Dynamics Ax 2009 client and set the debug mode to : When breakpoint.

Set the Business connector proxy user to the user you want to debug with everywhere
- On the application pool
- Inside dynamics Ax system services account
Allow the IIS windows service to interact with the desktop
This one is also crucial otherwise the IIS cannot interact with the debugger!
Add the debugging user to the Dynamics Ax Webservice Administrators
Log on to the AOS server with the debug user on the CONSOLE
Use the mstsc /admin command to log on to the AOS on the console session.
Manually start the Dynamics Ax Debugger
To finally start debugging, make sure you have opened an instance of the debugger on the machine where the business connector is running. In my case on the IIS web server. Make sure to run the debugger as Administrator









