Using ABBYY FineReader Engine in Multi-Threaded Server Applications

Using ABBYY FineReader Engine in server applications has certain specifics:

  • multiple independent requests must be handled simultaneously in multiple threads within one process
  • the Engine runs under a server operating system on a high-performance multi-CPU computer
  • using with special accounts (Network Service, Local Service, ASPNET)

When developing ABBYY FineReader Engine 12, the above specifics were taken into consideration, and tools were included in the API, which enables you to get thread-safe FineReader Engine objects as part of a server process or in separate processes. Using FineReader Engine in multiple processes allows you to create a pool of objects that work simultaneously and use the full CPU power of the server computer. This is the optimal approach in most server scenarios.

Loading the Engine object into a server application

The optimal method of loading the Engine into a server application is to load it by means of COM into a separate process as an out-of-process server. This method automatically eliminates all difficulties related to multi-threading: all operations with the ABBYY FineReader Engine objects are serialized by means of COM, which allows you to create several Engine instances in several processes and work with them simultaneously from within the server process. At the same time this method is easy to use. The Engine object is loaded by using the OutprocLoader object, which implements an IEngineLoader interface.

C# code

This method has one important drawback, however. When using it with special accounts, permissions may be required to run OutprocLoader for such accounts. However, this, and the need to register FREngine.dll, is not very crucial in server products, as server applications are usually installed by experienced administrators on a small number of computers.


  • Account permissions can be set up using the DCOM Config utility (either type DCOMCNFG in the command line, or select Control Panel > Administrative Tools > Component Services). In the console tree, locate the Component Services > Computers > My Computer > DCOM Config folder, right-click ABBYY FineReader Engine 12.5 Loader (Local Server), and click Properties. A dialog box will open. Click the Security tab. Under Launch Permissions, click Customize, and then click Edit to specify the accounts that can launch the application.

    Note that on a 64-bit operating system the registered DCOM-application is available in the 32-bit MMC console, which can be run using the following command line:

    "mmc comexp.msc /32"
  • To register FREngine.dll when installing your application on an end-user computer, use the regsvr32 utility. If you are on a 64-bit operating system, the 64-bit version of regsvr32 will run by default. Use the following command line:
regsvr32 /s /n /i:"<path to the Inc folder>" "<path to FREngine.dll>"
  • We recommend that you use a Network license both for debugging your server application and for running it.

Additionally you can manage the priority of a host process and control whether it is alive using the IHostProcessControl interface.

Other methods of loading ABBYY FineReader Engine are also available. However, they have certain characteristics which considerably limit their use in server applications.

  • ABBYY FineReader Engine can be loaded by means of COM as an in-process server within the current process. This method also automatically eliminates all difficulties related to multi-threading (all operations with the ABBYY FineReader Engine objects are serialized by means of COM) and is easy to use. However, this method does not allow you to organize simultaneous processing using several instances of the Engine object, which in many ways limits the performance of the server. Another drawback of this method is that it requires registration of FREngine.dll when installing the application on an end user's computer.
  • FREngine.dll can be loaded manually. This is the standard method of loading the library. This method requires that all operations with the Engine object be performed within the same thread where the Engine object was initialized. In addition, it does not allow you to initialize more than one Engine object per process. This considerably limits the performance of the server. For this reason we do not recommend using this method. One advantage of this method is that it does not require registration of FREngine.dll when installing the application on end user's computer.

For detailed descriptions of the three loading methods available in ABBYY FineReader Engine, see Different Ways to Load the Engine Object.


The EnginesPool code sample provides an implementation of processors pool in a multithreaded application, and you can start developing your own application by modifying this sample to fit your needs.

See also

Different Ways to Load Engine Object

24.03.2023 8:51:52

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.