无法加载文件或程序集'Actipro软件.Shared.Net20' 或其依赖项之一

本文关键字:Net20 依赖 Shared 软件 加载 程序集 Actipro 文件 | 更新日期: 2023-09-27 18:34:33

嗨,每个1我需要帮助,我在运行应用程序时收到此错误

"无法加载文件或程序集'ActiproSoftware.Shared.Net20'或其依赖项之一。尝试加载格式不正确的程序。'">

说明:执行当前 Web 请求期间发生未经处理的异常。请查看堆栈跟踪,了解有关错误及其在代码中起源位置的详细信息。

异常详细信息:System.BadImageFormatException:无法加载文件或程序集"ActiproSoftware.Shared.Net20"或其依赖项之一。尝试加载格式不正确的程序。

源错误:

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

程序集加载

跟踪:以下信息有助于确定无法加载程序集"ActiproSoftware.Shared.Net20"的原因。

WRN:程序集绑定日志记录已关闭。若要启用程序集绑定失败日志记录,请设置注册表值 [HKLM''软件''Microsoft''Fusion!启用日志] (DWORD( 到 1。注意:程序集绑定失败日志记录会降低一些性能。要关闭此功能,请删除注册表值 [HKLM''软件''Microsoft''Fusion!启用日志]。

堆栈跟踪:

[BadImageFormatException:无法加载文件或程序集"ActiproSoftware.Shared.Net20"或其依赖项之一。尝试加载格式不正确的程序。 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.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence AssemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks( +210 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection( +242 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&stackMark, Boolean forIntrospection( +17 System.Reflection.Assembly.Load(String AssemblyString( +35 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective( +122

[配置错误异常:无法加载文件或程序集"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.Web.Compilation.BuildManager.ExecutePreAppStart(( +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 context( +12979668 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context( +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context( +12819261

无法加载文件或程序集'Actipro软件.Shared.Net20' 或其依赖项之一

我得到的答案如下 进入 IIS 7 管理器控制台,找到运行应用的应用程序池,右键单击它,转到"高级设置",然后将"启用 32 位应用程序"设置更改为 true:

错误的图像格式异常通常意味着您尝试将 x64 程序集/本机 DLL 加载到 32 位进程中,反之亦然,将 32 位程序集加载到 x64 进程中。

如果应用程序以 32 位运行,则首先签入任务管理器

,或者如果针对特定指令集(x86 或 x64(进行编译,或者在项目的同一属性页上选中了"首选 32 位",则首先签入任务管理器。然后确定您的程序集"ActiproSoftware.Shared.Net20"是哪种类型(使用反射器(。两者都应该是任何 CPU 或相同类型的 x86 或 x64。如果没有区别,则仍然可能是某个natice库或该程序集的依赖项导致了麻烦。因此,使用反射器检查"ActiproSoftware.Shared.Net20"的引用,以及您是否在正确的版本中拥有所有这些引用。