Could not load file or assembly "AAAAA" or one of its dependencies. Trying to load program with an incorrect format.
Description: The execution of the current Web request during unhandled exception occurs. Please review the stack trace for more information about the error and understand the details of the error code of the source of the lead.
Exception Details: System.BadImageFormatException: Could not load file or assembly " AAAAA " or one of its dependencies. Trying to load program with an incorrect format.
Source Error:
执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 |
Assembly Load Trace: The following information will help determine why the assembly " AAAAA reason" could not be loaded.
WRN: Assembly binding logging is turned off. To enable assembly bind failure logging, set the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog] (DWORD) to 1. Note: there will be some with assembly bind failure logging performance penalty associated with it. To turn this feature off, remove the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog]. |
Stack Trace:
[BadImageFormatException: Could not load file or assembly " AAAAA " or one of its dependencies. Trying to load 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) +118 [ConfigurationErrorsException: Could not load file or assembly " AAAAA " or one of its dependencies. Trying to load program with an incorrect format. ] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11392147 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +484 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +127 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334 System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1087 [HttpException (0x80004005): Could not load file or assembly " AAAAA " or one of its dependencies. Trying to load program with an incorrect format. ] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11524352 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4782309 |
Cause: The operating system is 64-bit, but the release of the program refers to a number of 32-bit ddl, so there's a compatibility problem
solution: If a 64-bit machine, IIS-- application pool - Advanced Settings - Enabling 32-bit applications: true.
Solution two: Modify Project Properties - generation - the target platform (for example, X86 \ X64)
Reproduced in: https: //www.cnblogs.com/Alenliu/p/3955775.html