Tessnet2 in WebForms .Net returns DllNotFoundExcep

2019-09-01 09:57发布

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)

2条回答
祖国的老花朵
2楼-- · 2019-09-01 10:04

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

查看更多
趁早两清
3楼-- · 2019-09-01 10:16

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

查看更多
登录 后发表回答