[英]Could not load file or assembly 'Elasticsearch.Net' or one of its dependencies
[英]Could not load file or assembly'ActiproSoftware.Shared.Net20' or one of its dependencies
大家好,我需要帮助我在运行应用程序时遇到此错误
“无法加载文件或程序集'ActiproSoftware.Shared.Net20'或其依赖项之一。试图加载格式不正确的程序。”
说明:执行当前Web请求期间发生未处理的异常。 请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。
异常详细信息:System.BadImageFormatException:无法加载文件或程序集'ActiproSoftware.Shared.Net20'或其依赖项之一。 试图加载格式错误的程序。
源错误:
当前Web请求的执行期间生成了未处理的异常。 可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。
程序集加载跟踪:以下信息有助于确定为什么无法加载程序集“ ActiproSoftware.Shared.Net20”。
WRN:程序集绑定日志记录已关闭。 要启用程序集绑定失败日志记录,请将注册表值[HKLM \\ Software \\ Microsoft \\ Fusion!EnableLog](DWORD)设置为1。注意:程序集绑定失败日志记录会降低性能。 要关闭此功能,请删除注册表值[HKLM \\ Software \\ Microsoft \\ Fusion!EnableLog]。
堆栈跟踪:
[BadImageFormatException:无法加载文件或程序集'ActiproSoftware.Shared.Net20'或其依赖项之一。 试图以错误的格式加载程序。] System.Reflection.RuntimeAssembly._nLoad(AssemblyName文件名,字符串codeBase,证据AssemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔throwOnFileNotFound,布尔值用于Introspection,布尔值抑制) 0系统。 stackMark,IntPtr pPrivHostBinder,用于自省的布尔值)+242 System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString,证据AssemblySecurity,StackCrawlMark&stackMark,用于自省的布尔值)+17 System.Reflection.Assembly.Load(String assemblyString)+35 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)+122
[ConfigurationErrorsException:无法加载文件或程序集'ActiproSoftware.Shared.Net20'或其依赖项之一。 试图加载格式不正确的程序。] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)+12857578 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()+503 System.Web.Configuration .AssemblyInfo.get_AssemblyInternal()+142 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)+334 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath,Boolean&isRefAssemblyLoaded)+148 System.Build.Start.App.Appilation ()+172 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters HostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)+1151
[HttpException(0x80004005):无法加载文件或程序集'ActiproSoftware.Shared.Net20'或其依赖项之一。 试图加载格式错误的程序。] System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+12979668 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)+159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr ,HttpContext上下文)+12819261
错误的图像格式异常通常意味着您试图将x64程序集/本机DLL加载到32Bit进程中,反之亦然,将32Bit程序集加载到x64进程中。
首先,在任务管理器中检查您的应用程序是否以32位运行,或者是否在构建中的项目设置中运行,是否根据特定指令集(x86或x64)进行编译,或者在项目的同一属性页上是否选中了“首选32位” 。 然后确定程序集“ ActiproSoftware.Shared.Net20”是哪种类型(使用反射器)。 两者都应为任何CPU或相同类型的x86或x64。 如果没有差异,那么可能仍然是某些natice库或该程序集的依赖项引起了麻烦。 因此,请检查带有反射器的“ ActiproSoftware.Shared.Net20”的引用,以及是否都具有正确的构建。
我得到的答案如下:您进入IIS 7管理器控制台,找到您的应用程序正在其中运行的应用程序池,右键单击它,转到“高级设置”,然后将“启用32位应用程序”设置更改为true:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.