0

我们正在尝试使用 WebSupergoo 的 ABCpdf .NET v10。如果我们使用他们的安装程序,效果会很好。但是 v8 已经安装在服务器上,其他项目正在使用它,所以我们现在不想运行安装程序。(希望在不久的将来我们可以在不同的机器上测试安装和/或升级这些项目,但这个项目不能等待。)

WebSupergoo ( http://www.websupergoo.com/helppdfnet/default.htm?page=source%2F3-concepts%2F6-installation.htm ) 的“手动安装”说明指示放置 3 个主要 DLL (ABCpdf.dll 、ABCpdf10-32.dll 和 ABCpdf10-64.dll) 进入 bin 文件夹并添加对 ABCpdf.dll 的引用。

我们真的不希望它们在 bin 文件夹中,因为源代码管理设置为不从该文件夹添加任何内容。但是,为了让它工作(现在),它们被放置在该文件夹中。然后,当我尝试运行该项目时,出现以下错误(为安全起见更改了文件夹名称):

 System.BadImageFormatException was unhandled by user code
  HResult=-2146234344
  Message=Could not load file or assembly 'file:///D:\\Projects\Solution\WebProject\bin\ABCpdf10-32.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
  Source=mscorlib
  FileName=file:///D:\Projects\Solution\WebProject\bin\ABCpdf10-32.dll
  FusionLog==== Pre-bind state information ===
LOG: Where-ref bind. Location = D:\Projects\Solution\WebProject\bin\ABCpdf10-32.dll
LOG: Appbase = file:///D:/Projects/Solution/WebProject/
LOG: Initial PrivatePath = D:\Projects\Solution\WebProject\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: D:\\Projects\Solution\WebProject\web.config
LOG: Using host configuration file: D:\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///D:/Projects/Solution/WebProject/bin/ABCpdf10-32.dll.
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.

  StackTrace:
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.LoadFrom(String assemblyFile)
       at WebActivator.PreApplicationStartCode.Start() in D:\Code\Bitbucket\WebActivator\WebActivator\PreApplicationStartCode.cs:line 11
  InnerException:

我们首选的方法是将它们放在“lib”文件夹中(目前在解决方案级别)。因此,我将 3 个 DLL 放在该文件夹中并添加了引用。该项目编译并运行,但是当我们尝试创建 PDF 时,我们收到以下错误:

Unable to load DLL 'ABCpdf10-32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

WebSupergoo 支持说:“ABCpdf10-32.dll 不是程序集,所以它当然不包含程序集清单”。

我尝试将 ABCpdf10-32.dll 从 bin 文件夹中取出,但 ABCpdf10-64.dll 出现相同的错误。

我尝试在引用 False 时设置“复制本地”。没变。

复制本地:https ://msdn.microsoft.com/en-us/library/t1zz5y8c(v=vs.90).aspx

我尝试使用“探测”技术。我在项目的 web.config 和 app.config 文件中都尝试了它(解决方案似乎没有一个)。我还尝试将 lib 文件夹移动到项目本身中。没变。

探测:https ://msdn.microsoft.com/en-us/library/823z9h8w(v=vs.110).aspx

我不确定此时还可以尝试什么。任何帮助将不胜感激!

4

1 回答 1

0

System.BadImageFormatException 它是一个一般异常,通常在您在 64 位环境中使用 32 位 DLL 时发生,反之亦然。

Web 应用程序:它们用于加载文件夹上的所有 dll,无论是否使用(WebActivator.PreApplicationStartCode.Start())。检查 IIS 池,它是 64 位的吗?然后删除文件夹或子文件夹上的所有 32 个 dll。你是强迫它到32吗?然后删除文件夹或子文件夹上的所有 64 个 dll。

于 2016-04-22T12:20:01.637 回答