Using ABBYY FlexiCapture SDK in Multi-Threaded Server Applications

Using ABBYY FlexiCapture SDK 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 FlexiCapture 12 SDK, the above specifics were taken into consideration and tools were included into the API which enable you to get thread-safe ABBYY FlexiCapture SDK objects as part of a server process or in separate processes. Using ABBYY FlexiCapture SDK 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 FlexiCapture SDK 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 the 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 FCEngine.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 FlexiCapture 12 SDK 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 FCEngine.dll when installing your application on an end-user computer, use the following command line:
regsvr32 /s /n /i:"<path to the Inc folder>" "<path to FCEngine.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 work processes and control whether their parent process is alive and terminate if it is not. Use the IWorkProcessControl interface.

Other methods of loading ABBYY FlexiCapture SDK are also available. However, they have certain specifics which considerably limit their use in server applications.

  • ABBYY FlexiCapture SDK 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 FlexiCapture SDK 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 FCEngine.dll when installing the application on an end user's computer.
  • FCEngine.dll can be loaded manually. This is the standard method that was used in older versions of ABBYY FlexiCapture SDK. 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 FCEngine.dll when installing the application on end user's computer.

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

See also

Different Ways to Load Engine Object

15.08.2023 13:19:30

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.