Enterprise Portal Debugging in Dynamics AX
Enterprise Portal Debugging in Dynamics AX
Today, I will talk about Enterprise Portal debugging, which is similar in Dynamics AX 2009 and AX 2012.
Different parts of a page can use the X++ code: web forms, weblets, reports. This code can be debugged using the debugger for Microsoft Dynamics AX, but only if the system is running Internet Information Services (IIS). To setup the X++ debugging for the pages you need to take the following steps:
- Login into the AOS server to start Microsoft Dynamics AX Server Configuration Utility. For AX 2009, go to Start > Control Panel > Administrative Tools > Microsoft Dynamics AX 2009 Server Configuration. For AX 2012 click Start > Control Panel > Administrative Tools > Microsoft Dynamics AX 2012 Server Configuration.
- Now, the configuration that allows debugging needs to be created: click Manage > Create configuration. In the new window name the configuration and click OK.
- Open the tab page Application Object Server and make sure that the check-box Enable breakpoints to debug code X++ code running on this server is selected. Apply your changes and close the configuration window. If you receive a message requiring the restart of AOS, then specify that it should be restarted.
- Log into Enterprise Portal and IIS server, for remote system use Terminal Services: Start > Run > in the new window type mstsc /console > OK.
- Open the Services window in the system: Start > Administrative Tools > Services. Now open the Properties window of World Wide Web Publishing Service. Select the tab page Log On and make sure that the Allow service to interact with desktop check-box is marked. Close the properties window by clicking OK when done.
- Find the web.config file that is located in \Inetpub\wwwroot\wss\VirtualDirectories\<Port>\, where Port is a port number of a site with Enterprise Portal installed. Open the file.
- When the web session is stopped at a breakpoint, you may get a time-out error. To reduce this risk, set a debug attribute of a compilation element to true in web.config. Save changes.
- Open Command Prompt: Start > Run > in the new window type cmd > OK. Type iisreset to reset the IIS.
- Start the Dynamics AX Configuration Utility: Start > Control Panel > Administrative Tools > Microsoft Dynamics AX 2009 Configuration or Start > Control Panel > Administrative Tools > Microsoft Dynamics AX 2012 Configuration. Select Business Connector (non-interactive use only) in the Configuration Target menu.
- Create a configuration for debugging: Manage > Create configuration. Name the configuration and click OK.
- Select the tab page Developer and make sure that Enable user breakpoints to debug code running in the Business Connector is checked. Apply your changes and close the configuration window by pressing OK.
- Open the Dynamics AX client. Select Tools > Options from the menu, open the Options window and select the tab page Development. Set the Debug mode field to When breakpoint, apply your changes and close the Options window.
After the setup is complete, you can debug the X++ code from the web page:
- Log in to Enterprise Portal and the IIS server. Use Terminal Services for the remote system: Start > Run > type mstsc /console in a new window > OK. Debugging will not work for the remote system unless you use a console while connecting.
- Open the Microsoft Dynamics AX client and make sure that your user is one of the following:
1. The user who started the session of Microsoft Dynamics AX
2. The user who will set the breakpoints in the X++ code
3. A member of the Microsoft Dynamics AX Debugging Users local group on Windows (for AX 2012)
- Open a new Development Workspace. Go to AOT and open the desired X++ code of the debugging element (e.g. class, data set, web form, web report, weblet, report). Set the breakpoint.
- Check that the debugger is opened before running a code. To open the debugger in the Development Workspace use the menu Tools > Development tools > Debugger if you are working with AX 2009. For Dynamics AX 2012 use Tools > Debugger for AX 2012 and make sure that it is running with the administrative privileges.
- When opening a web page with a desired element, the debugger will stop at your breakpoint. If it doesn’t happen, try restarting the server where Dynamics AX is installed.
I hope you found this information was useful! Next week I’ll write about debugging .NET assemblies in Dynamics AX.