AX / D365FO – Debug Production environment on D365FO On-Premise version

If you have an On-premise D365FO installation it is possible to debug production or test environments by using a development VM and remote debugging tool

Just follow these steps :

Use a D365 developer environment

Use a development environment which is on the domain (and of course the network) with the AOS machine

The dev environment code must be the same as the AOS, so before to start I suggest to make a full models Build.

….This operation could take a lot of time….

Copy the remote debugging tools from developer environment to the AOS

On the developer environment you’ll find “Remote Debugger folder” on the Windows start menu:

If you cannot find you can try searching in file explorer.

The path could differ Depending on your Visual Studio version.

I have VS2017 so I found it here : C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Remote Debugger

Run the remote debugger on the AOS

Copy the x64 folder from there, and paste it into the AOS you’re going to debug (wherever you want, even on the desktop).

Note that if you have multiple AOS in your on-premises environment, turn off all but one of them – so that all requests will go to that one AOS that you’re debugging.

Within the folder double click msvsmon.exe:

The remote debugger will open, and look something like this, take note of the machine name and port, in my case it’s SQLAOSF1AOS1:4020.

This means AOS is waiting for incoming remote connections

Configure the developer environment

Open Visual Studio on DEV env and go to Tools > Options, set the following options:

Dynamics 365, Debugging: Uncheck “Load symbols only for items in the solution”

Debugging, General: Uncheck “Enable just my code”


Debugging, Symbols: add paths for all packages you want to debug, pointing to the location of the symbols files on the AOS you want to debug, because my account is an Administrator on the AOS box I can use the default C$ share to add those paths, like this:

\\Your-server-name\C$\SF\xxxxx-UATAOS\Fabric\work\Applications\AXSFType_App125\AXSF.Code.1.0.20220331102150\Packages\Your-package.name\bin

Now put a breakpoint in the object you want to debug

Go in Debug > Attach to process

Click on Find

In the tab “Auto detect” you’ll find the AOT server (if you’ve started the remote debugger described in the previous sections).

Click on it and “Select

It will ask to enter Administrator credentials

In the connection target you’ll find the AOS remote address followed by :4020 port.

Then at the bottom click “Show processes from all users” and select the AXService.exe process, this is the AOS.

Now access D365FO User Web interface in your AOS and open the form or any other object you want to debug.

Use the program and you will see that the visual studio in the dev environement will stop at the exact point where you entered the breakpoint

If the code doesn’t stop at the breakpoint the possible reasons could be :

  • Your session is attached at another AOS (in case you have more than one AOS). To solve the issue temporary stop the “Service Fabric Host service” of the second AOS.
    ATTENTION!!! If you’re in Production environment this will logout all the users that are logged in the second AOS!!! So pay attention….
  • Remote Symbols were not loaded correctly… so try to close and open Visual Studio and try again
  • Develpment environment code is not aligned with production environment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s