Table of Contents

Installing and Configuring Components for Communication using a Local Agent

The component configuration required to print receipts on a fiscal printer should be carried out on a Windows machine (a machine with Internet access or a VM on Azure), where the IntegroFiscalAgentWorker service will be running, which allows access to local resources.

Configuring a Local Agent to Communicate with a Fiscal Printer

The following procedure explains how you can configure the IntegroFiscalAgentWorker service on a Windows machine.

Important

Before proceeding with the configuration, download the appropriate IntegroFiscalAgentWorker file from the Additional Components directory available at IT.integro Product Portal.

Important

You must select the appropriate location for the service. The machine name must not contain any whitespaces. The IntegroFiscalAgentWorker service will reference and retrieve libraries from this location, so you will not be able to change the location after the service has been created.

  1. Unzip the IntegroFiscalAgentWorker.zip file to the desired location on the machine.
  2. Configure the urls parameter in the appsettings.json file in the unzipped catalog. The urls parameter specifies the address at which the agent is available. See an example of how the *urls* parameter can be specified in the appsettings.json file:
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "urls": "http://<adres_IP_maszyny>:<port_komunikacji>"
}

where:

  • <adres_IP_maszyny> - Specifies the IP address of the machine on which the agent will be defined, and it should be a static address assigned to this machine.
  • <port_komunikacji> - Specifies the port on which the configured agent will listen, and the agent should be open in the firewall of the machine.
  1. Run PowerShell as an administrator.
  2. To create a service, run the following command:
New-Service -Name IntegroFiscalAgent -DisplayName "Integro Fiscal Local Agent" -BinaryPathName <exe path> -Description "Allows to reach On-Prem resourcs from Business Central through Web API." -StartupType Automatic

where:

  • <exe path> - Specifies the path to the IntegroFiscalAgentWorker.exe file that is located in the selected path for the agent.
  1. To start the service, run the following command:
Start-Service IntegroFiscalAgent
  1. To stop the service, run the following command:
Stop-Service IntegroFiscalAgent
Note

To remove a service, run the following command: For powershell >= 6.0: powershell Remove-Service IntegroFiscalAgent ; for powershell < 6.0: ```powershell sc.exe delete IntegroFiscalAgent

Error Logging

The IntegroFiscalAgentWorker service logs errors in the event log using the UniversalRequestHandlercommands.

Configuration of the Agent in Development Mode for Communication with a Fiscal Printer

If the IntegroFiscalAgentWorker application is run in Development mode from the command line (for testing purposes), then you can use a diagnostic page (available at the address and port where the agent is hosted) to send requests to the agent.

The following procedure explains how you can run the IntegroFiscalAgentWorker application on a Windows machine for testing purposes:

  1. Start the command prompt with administrator privileges.
  2. To run the application, run the following command:
IntegroFiscalAgentWorker.exe --environment Development --urls "http://<adres_IP_maszyny>:<port_komunikacji>"

where:

  • <adres_IP_maszyny> - Specifies the IP address of the machine on which the agent will be defined, it should be a static address assigned to this machine.
  • <port_komunikacji> - Specifies the port on which the configured agent will listen, it should be open in the firewall of the machine.

All communication with the printer will be displayed on the command line.

Configuration in Dynamics 365 Business Central

The following procedure explains how to set up a connection to a fiscal printer in Dynamics 365 Business Central using IntegroFiscalAgentWorker.exe.

Preconfigure the fiscal printer as described in the Fiscal Printer Configuration article.

  1. Choose the Lightbulb that opens the Tell Me featureEnter Fiscal Printers, and then choose the related link.

  2. On the Fiscal Printer Card page fill in the required fields as follows:

  • Use Local Network - Select the relevant option.
  • Local Agent URL - Set the URL according to the following pattern: http://<machine_IP_address>:<communication_port>. The addres is the same as the url address that has been set in the local agent configuration.

Setup Testing

The following procedure explains how to test the connection between Dynamics 365 Business Central and a fiscal printer using a dedicated agent service.

  1. Choose the Lightbulb that opens the Tell Me featureEnter Fiscal Printers, and then choose the related link.

  2. On the Fiscal Printer Card page, choose the Test Connection.

Note

Errors that may occur when testing a connection indicate that: - the printer is not properly connected to the machine used to run the agent service for communication; - the fiscal printer is configured differently compared to the settings in Dynamics 365 Business Central; - configuration on the Dynamics 365 Business Central is incorrect.

  1. When the connection test is successful, you can print a test receipt. To do so, choose the Print Test Receipt on the Fiscal Printer Card page.
Note

Printing a test receipt is recommended only when the fiscal printer is working in training mode.

See Also

Fiscal Printer Setup