2012-05-23 43 views
0

我已經實現了Tessnet2庫以在我的Web項目中工作。 調試時,我已經擺脫了所有「常見」bug ++。Tessnet2「無法加載文件或難以辨認」

當我部署該解決方案的網絡服務器使用Visual Studio 2010,並測試網站,我收到錯誤消息:

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文件夾服務器...

所有其他庫也應該存在。

回答

1

服務器是64位進程,tessnet2_32.dll是32位。所以你不能加載DLL並得到這個異常。

+0

這是有道理的...我會嘗試切換到64位DLL ... :) –

+0

然後我的問題發生了變化,我將如何使用Visual Studio 2010中的64位版本進行開發?我只能得到32位的那個在那裏工作...... –

+0

這取決於你用於開發的Web服務器。 Visual Studio本身的體系結構並不重要。確保你有64位版本的Windows。然後,您應該在開發時切換到「真正的」IIS(請檢查您的項目設置),以便您的環境更接近生產環境。 Web服務器的體系結構定義可以加載哪種類型的DLL。 – fero