首页 > 解决方案 > 将“Interop.zkemkeeper.dll”导入 WCF 服务时出错

问题描述

我有“WCF 服务应用程序”,它是 .net 框架 4.6.1。我需要添加“Interop.zkemkeeper.dll”作为参考。但是当我将此添加为对 WCF 服务的引用并且当服务声明时它在浏览器上显示以下错误。

“'/'应用程序中的服务器错误。

无法加载文件或程序集“Interop.zkemkeeper”或其依赖项之一。试图加载格式不正确的程序。说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.BadImageFormatException:无法加载文件或程序集“Interop.zkemkeeper”或其依赖项之一。试图加载格式不正确的程序。

源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

程序集加载跟踪:以下信息有助于确定无法加载程序集“Interop.zkemkeeper”的原因。

=== 预绑定状态信息 === LOG:DisplayName = Interop.zkemkeeper(部分) WRN:为程序集提供了部分绑定信息:WRN:程序集名称:Interop.zkemkeeper | 域 ID:2 警告:仅提供部分程序集显示名称时会发生部分绑定。警告:这可能会导致活页夹加载不正确的程序集。WRN:建议为程序集提供完全指定的文本标识,WRN:由简单名称、版本、文化和公钥标记组成。警告:有关此问题的详细信息和常见解决方案,请参阅白皮书http://go.microsoft.com/fwlink/?LinkId=109270。LOG: Appbase = file:///C:/Users/Dushmantha/source/repos/VFTService/VFTService/ LOG: Initial PrivatePath = C:\Users\Dushmantha\source\repos\VFTService\VFTService\bin

调用程序集:(未知)。

LOG:此绑定在默认加载上下文中开始。日志:使用应用程序配置文件:C:\Users\Dushmantha\source\repos\VFTService\VFTService\web.config 日志:使用主机配置文件:C:\Users\Dushmantha\Documents\IISExpress\config\aspnet.config 日志:使用 C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config 中的机器配置文件。LOG:此时未将策略应用于引用(私有、自定义、部分或基于位置的程序集绑定)。日志:尝试下载新的 URL 文件:///C:/Users/Dushmantha/AppData/Local/Temp/Temporary ASP.NET Files/vs/224635a0/d24b75c0/Interop.zkemkeeper.DLL。日志:尝试下载新的 URL 文件:///C:/Users/Dushmantha/AppData/Local/Temp/Temporary ASP.NET Files/vs/224635a0/d24b75c0/Interop.zkemkeeper/Interop.zkemkeeper.DLL。日志:正在尝试下载新的 URL 文件:///C:/Users/Dushmantha/source/repos/VFTService/VFTService/bin/Interop.zkemkeeper.DLL。ERR:无法完成程序集的设置(hr = 0x8007000b)。探测终止。

堆栈跟踪:

[BadImageFormatException:无法加载文件或程序集“Interop.zkemkeeper”或其依赖项之一。试图加载格式不正确的程序。] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) + 0 System.Reflection.RuntimeAssembly.nLoad(AssemblyName 文件名,字符串代码库,证据 assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark 和 stackMark,IntPtr pPrivHostBinder,布尔 throwOnFileNotFound,布尔 forIntrospection,布尔 suppressSecurityChecks)+36 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,

[ConfigurationErrorsException:无法加载文件或程序集“Interop.zkemkeeper”或其依赖项之一。试图加载格式不正确的程序。] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217 System.Web.Configuration .CompilationSection.LoadAssembly(AssemblyInfo ai) +130 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath , Boolean& isRefAssemblyLoaded) +290 System.Web.Compilation.BuildManager。

[HttpException(0x80004005):无法加载文件或程序集“Interop.zkemkeeper”或其依赖项之一。试图加载格式不正确的程序。] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10075108 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr , HttpContext 上下文) +254"

标签: c#wcfvisual-studio-2017zkteco

解决方案


您可以尝试将平台目标更改为 x86 吗?

  1. 单击工具栏上的构建按钮
  2. 单击配置管理器
  3. 然后将平台目标设置为 x86

推荐阅读