0

When I run this code under my account in Visual Studio debugger

_alprNet = new AlprNet("eu", "openalpr.conf", "runtime_data");
if (!_alprNet.IsLoaded())
{
    Tools.LogError("!!! OpenALPR failed to load.");

It works OK and AlprNet loads.

But when I install the Windows service and start this service I get "!!! OpenALPR failed to load." with no additional information.

I have all the DLLs and the runtime_data in the folder where my windows service's exe file is installed, exactly the same way as it is in bin\Debug folder.

How to find the reason why AlprNet failed to load?

Vojtěch Dohnal
  • 7,867
  • 3
  • 43
  • 105

1 Answers1

0

In case it is useful for anyone:

This line in OnStart method before creating new AlprNet fixed the problem:

System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);

https://stackoverflow.com/a/10385563/2224701

Apparently the non .NET DLLs dependencies could not be solved without this.

Vojtěch Dohnal
  • 7,867
  • 3
  • 43
  • 105