问题
I wrote a basic app using Tessnet2 and now trying to move it to a WebForms website.
Copied the logic etc. but when I run it I get an error message(Exception: DllNotFoundException)
"An exception of type System.DllNotFoundException" occured in Tesseract.dll but was not handled in user code.
Additional information: Failed to find library "liblept172.dll" for platform x86."
As said above, this code works as a C# console and after applying necessary logic to move it to the website I thought I moved everything correctly but keep getting this error. Any thoughts where to look?
EDIT2:
Digged it out a bit deeper and the part that fails is actually ILibraryLoaderLogic
IntPtr LoadLibrary(string fileName);
Even if the file is actually there? (there appears to be platform difference in what
SystemManager.GetPlatformName();
returns as the console runs under x64 but website under x86)
回答1:
Obviously quite long after the fact, but in my situation it turns out the machine I deployed to didn't have the VS2015 x86 & x64 runtimes installed. The runtimes are dependencies as described here: https://recordnotfound.com/tesseract-charlesw-26531
回答2:
Another issue that can appear is that the respective libs are not set to copy to the Output Directory. The way I solved it was by changing the "Copy to Output Directory" setting for the x86/x64 libs to "Copy always/if newer", then everything worked as expected
来源:https://stackoverflow.com/questions/36480823/tessnet2-in-webforms-net-returns-dllnotfoundexception-liblept172-dll