Tessnet2“无法加载文件或组合”

本文关键字:组合 文件 加载 Tessnet2 | 更新日期: 2023-09-27 18:35:10

我已经实现了Tessnet2库来在我的Web项目中工作。在调试时,我已经摆脱了所有"通常"的错误++。

当我使用 Visual Studio 2010 将此解决方案部署到 Web 服务器并测试站点时,我收到错误消息:

Could not load file or assembly 'tessnet2_32' or one of its dependencies. 
An attempt was made to load a program with an incorrect format.

堆栈跟踪如下所示:

[BadImageFormatException: Could not load file or assembly 'tessnet2_32' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +123
[ConfigurationErrorsException: Could not load file or assembly 'tessnet2_32' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11568160
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +485
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +79
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +337
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167
[HttpException (0x80004005): Could not load file or assembly 'tessnet2_32' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11700896
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +11532014

问题是,以前有人见过这个吗? 并处理过它? 还是知道修复方法?

我尝试将tessdata文件夹移动到服务器上的bin文件夹,我已经确保tessnet2_32.dll文件和pdb文件在服务器上的bin文件夹中...

所有其他库也应存在。

Tessnet2“无法加载文件或组合”

服务器是 64 位进程,tessnet2_32.dll是 32 位进程。因此,您无法加载 DLL 并获取此异常。