Run the Document Routing Agent as a Windows service
The Document Routing Agent includes an option that lets you select the mode of execution. The process can run as either a desktop application or a Microsoft Windows service. When the application runs as a Windows service, it can be started automatically after a computer restart. It can also be configured to run under the security context of a specific user account. This enhancement lets customers host the Document Routing Agent on secured domain resources such as network print servers.
This topic provides important information that will help you select the correct execution mode.
An application is a program that a user interacts with on the desktop. A service is a process that runs in the background and doesn't have an active window. The Document Routing Agent now supports both execution modes. It's important that you understand why you might select one mode instead of the other and the steps that are involved in running the process as a service. For more information about Windows services, see Introduction to Windows Service Applications. Here are some of the main benefits of running the Document Routing Agent as a background service:
- The service can be configured to start automatically after a computer restart. No user intervention is required.
- The service runs in the background. No active application runs in the notification area.
- The service routes documents without requiring that a user sign in by using cached credentials.
Although there are many benefits of running the Document Routing Agent as a Windows service, there are also limitations. The next section discusses an issue that affects the handling of document reports, such as checks, that require custom page margins.
Documents that require custom margins
When the Document Routing Agent runs as a Windows service, document reports, such as checks, that require custom margins can't be printed directly to network printers. Instead, the Document Routing Agent automatically routes those document to a target folder. New configuration properties in the application's Settings dialog box let you define the target location for document reports that require custom margins.
When the Document Routing Agent runs as a desktop application, it continues to take advantage of Adobe Reader to spool the document to the shared printer device that is selected in Microsoft Dynamics 365 for Finance and Operations, Enterprise edition. To handle scenarios where documents that have custom margins must be printed, we recommend that you install the Document Routing Agent in multiple locations. Then install the printers that will handle those documents only on the Document Routing Agents that will run in desktop application mode. Alternatively, use a post-execution process to pick up the files in the target directory and direct them in the appropriate manner.
Install the latest build
- Save a copy of the current Document Routing Agent configuration file. This file is located at C:\Users\<UserID>\AppData\Local\Microsoft\Microsoft Dynamics 365 for Finance and Operations Document Routing\Microsoft.Dynamics.AX.Framework.DocumentRouting.config. In this path, <UserID> is the Active Directory Domain Services (AD DS) user name that the Document Routing Agent was installed under.
- Uninstall the current version of the Document Routing Agent.
Install the latest version of the Document Routing Agent by following the instructions in Install the Document Routing Agent to enable network printer devices.
Although you install the application at this point, don't run it yet.
Copy the configuration file from step 1, and paste it into the following directory: C:\ProgramData\Microsoft\Microsoft Dynamics 365 for Finance and Operations Document Routing. This step helps guarantee that all your previous configuration settings are used for the new version of the Document Routing Agent application.
- Run the Document Routing Agent.
- Sign in by using your Microsoft Azure Active Directory (Azure AD) or Finance and Operations credentials.
- View and verify your settings and printers by clicking the appropriate menu items.
The next section provides detailed instructions for selecting the Windows service execution mode.
Change the default execution mode
By default, the Document Routing Agent runs as a desktop application. To run the process as a Windows service, make sure that you're familiar with the process for installing the Document Routing Agent to enable network printer devices. Then complete the following tasks.
Update the execution mode for the Document Routing Agent
- Start the Document Routing Agent by using the desktop icon.
- Select the Sign In option, and sign in by using your Azure AD credentials.
- On the ribbon, select Settings.
- Enable the Run as a Windows Service option.
- Provide a target folder for PDF files that are produced for documents that have custom margins.
- Select OK, and close the Document Routing Agent window.
Configure and start the Windows service
- In Windows, start Service Manager.
- In the list, select Microsoft Dynamics 365 for Finance and Operations Document Routing Service.
- Right-click the name, and then select Properties.
On the Log On tab, select the This account option, and then supply the AD DS credentials that are used to run the service.
Make sure that the selected account has access to the shared network devices.
- Start the service.
The Document Routing Agent is now running as a Windows service.
Verify the network printer connection
- Verify that the active account has enough access rights to the network printer.
- Verify that the user account can successfully print to the network device by using Notepad or another local application.
Verify security roles
- To access the application links that are used to install the Document Routing Agent, the user must be part of the Document routing client security role.
Review the service account's access rights
- Verify that the DocumentRoutingService service is running as a domain account that has access to the network devices.
Refresh the Azure service token
- Azure authentication tokens must be refreshed every 90 days while the Document Routing Agent is running as a Windows service. To refresh the service token, start the client, and then sign out and sign back in by using the menu items.
Disable shared printers for remote access
- When you connect to the host machine by using Microsoft Remote Desktop, make sure that you clear the Printers option in the Local devices and resources section on the Local Resources tab.
Review the event logs
- On the host machine, start Event Viewer.
- Review the logs at Application and Services Logs > Microsoft > Dynamics > AX-SSRSReportsShared.