Tessnet2 in WebForms .Net returns DllNotFoundException liblept172.dll

混江龙づ霸主 提交于 2019-12-25 07:09:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!