简体   繁体   English

System.BadImageFormatException错误

[英]System.BadImageFormatException error

I am using Windows Server 2008 R2 Datacenter 64-bit OS. 我正在使用Windows Server 2008 R2 Datacenter 64位操作系统。 I am using Visual Studio 2013 that has a solution with 2 projects and I am encountering this error. 我正在使用具有2个项目的解决方案的Visual Studio 2013,并且遇到此错误。

Exception Details: System.BadImageFormatException: Could not load file or assembly 'EyeCantSeeEngine' or one of its dependencies. 异常详细信息:System.BadImageFormatException:无法加载文件或程序集'EyeCantSeeEngine'或其依赖项之一。 An attempt was made to load a program with an incorrect format. 试图加载格式错误的程序。

Source Error: 源错误:

An unhandled exception was generated during the execution of the current web request. 当前Web请求的执行期间生成了未处理的异常。 Information regarding the origin and location of the exception can be identified using the exception stack trace below. 可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。

Assembly Load Trace: The following information can be helpful to determine why the assembly 'EyeCantSeeEngine' could not be loaded. 程序集加载跟踪:以下信息有助于确定为什么无法加载程序集“ EyeCantSeeEngine”。

=== Pre-bind state information === LOG: DisplayName = EyeCantSeeEngine (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: EyeCantSeeEngine | ===预绑定状态信息===日志:DisplayName = EyeCantSeeEngine(部分)WRN:为部件提供了部分绑定信息:WRN:部件名称:EyeCantSeeEngine | Domain ID: 2 WRN: A partial bind occurs when only part of the assembly display name is provided. 域ID:2 WRN:当仅提供部分程序集显示名称时,将发生部分绑定。 WRN: This might result in the binder loading an incorrect assembly. WRN:这可能导致活页夹加载不正确的组件。 WRN: It is recommended to provide a fully specified textual identity for the assembly, WRN: that consists of the simple name, version, culture, and public key token. WRN:建议为程序集提供完全指定的文本标识,WRN:由简单名称,版本,区域性和公共密钥令牌组成。 WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue. WRN:有关此问题的更多信息和常见解决方案,请参见白皮书http://go.microsoft.com/fwlink/?LinkId=109270 LOG: Appbase = file:///C:/Users/Administrator/Documents/ISFC_Main/EyeCantSee/EyeCantSeeEngine/ LOG: Initial PrivatePath = C:\\Users\\Administrator\\Documents\\ISFC_Main\\EyeCantSee\\EyeCantSeeEngine\\bin 日志:Appbase = file:/// C:/ Users / Administrator / Documents / ISFC_Main / EyeCantSee / EyeCantSeeEngine / LOG:Initial PrivatePath = C:\\ Users \\ Administrator \\ Documents \\ ISFC_Main \\ EyeCantSee \\ EyeCantSeeEngine \\ bin

Calling assembly : (Unknown). 调用程序集:(未知)。

LOG: This bind starts in default load context. 日志:此绑定在默认的加载上下文中启动。 LOG: Using application configuration file: C:\\Users\\Administrator\\Documents\\ISFC_Main\\EyeCantSee\\EyeCantSeeEngine\\web.config LOG: Using host configuration file: C:\\Users\\uni\\Documents\\IISExpress\\config\\aspnet.config LOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\config\\machine.config. 日志:使用应用程序配置文件:C:\\ Users \\ Administrator \\ Documents \\ ISFC_Main \\ EyeCantSee \\ EyeCantSeeEngine \\ web.config日志:使用主机配置文件:C:\\ Users \\ uni \\ Documents \\ IISExpress \\ config \\ aspnet.config日志:使用C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\ config \\ machine.config中的计算机配置文件。 LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). 日志:目前未将策略应用于引用(私有,自定义,部分或基于位置的程序集绑定)。 LOG: Attempting download of new URL file:///C:/Users/uni/AppData/Local/Temp/1/Temporary ASP.NET Files/root/b917a818/774df716/EyeCantSeeEngine.DLL. 日志:尝试下载新的URL文件:/// C:/ Users / uni / AppData / Local / Temp / 1 / Temporary ASP.NET Files / root / b917a818 / 774df716 / EyeCantSeeEngine.DLL。 LOG: Attempting download of new URL file:///C:/Users/uni/AppData/Local/Temp/1/Temporary ASP.NET Files/root/b917a818/774df716/EyeCantSeeEngine/EyeCantSeeEngine.DLL. 日志:尝试下载新的URL文件:/// C:/ Users / uni / AppData / Local / Temp / 1 / Temporary ASP.NET Files / root / b917a818 / 774df716 / EyeCantSeeEngine / EyeCantSeeEngine.DLL。 LOG: Attempting download of new URL file:///C:/Users/Administrator/Documents/ISFC_Main/EyeCantSee/EyeCantSeeEngine/bin/EyeCantSeeEngine.DLL. 日志:尝试下载新的URL文件:/// C:/Users/Administrator/Documents/ISFC_Main/EyeCantSee/EyeCantSeeEngine/bin/EyeCantSeeEngine.DLL。 ERR: Failed to complete setup of assembly (hr = 0x8007000b). ERR:无法完成装配的设置(hr = 0x8007000b)。 Probing terminated. 探测终止。

Stack Trace: 堆栈跟踪:

[BadImageFormatException: Could not load file or assembly 'EyeCantSeeEngine' or one of its dependencies. [BadImageFormatException:无法加载文件或程序集'EyeCantSeeEngine'或其依赖项之一。 An attempt was made to load a program with an incorrect format.] 试图加载格式错误的程序。]
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文件名,字符串codeBase,证据AssemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔型throwOnFileNotFound,布尔型用于自省,布尔型抑制安全检查)+0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34 System.Reflection.RuntimeAssembly.nLoad(AssemblyName文件名,字符串codeBase,证据程序集安全性,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔型throwOnFileNotFound,布尔型用于自省,布尔型抑制安全检查)+34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔型throwOnFileNotFound,布尔型用于自省,布尔型抑制安全检查)+152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77 System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString,证据AssemblySecurity,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,用于自省的布尔值)+77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16 System.Reflection.Assembly.Load(String assemblyString) +28 System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString,证据assemblySecurity,StackCrawlMark&stackMark,用于自省的布尔值)+16 System.Reflection.Assembly.Load(字符串assemblyString)+28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,布尔型starDirective)+38

[ConfigurationErrorsException: Could not load file or assembly 'EyeCantSeeEngine' or one of its dependencies. [ConfigurationErrorsException:无法加载文件或程序集'EyeCantSeeEngine'或其依赖项之一。 An attempt was made to load a program with an incorrect format.] 试图加载格式错误的程序。]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,布尔型starDirective)+752
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()+218 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)+130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)+170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()+91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath,Boolean&isRefAssemblyLoaded)+285
System.Web.Compilation.BuildManager.ExecutePreAppStart() +153 System.Web.Compilation.BuildManager.ExecutePreAppStart()+153
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParametershostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)+521

[HttpException (0x80004005): Could not load file or assembly 'EyeCantSeeEngine' or one of its dependencies. [HttpException(0x80004005):无法加载文件或程序集'EyeCantSeeEngine'或其依赖项之一。 An attempt was made to load a program with an incorrect format.] 试图加载格式错误的程序。]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9950728 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+9950728 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)+101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext上下文)+254

I have tried changing the target platform of the project of the error from x64 to x86 and the error that I encounter next is this. 我尝试将错误项目的目标平台从x64更改为x86,接下来遇到的错误是这样。

Exception Details: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. 异常详细信息:System.OutOfMemoryException:引发了类型为“ System.OutOfMemoryException”的异常。

Source Error: 源错误:

An unhandled exception was generated during the execution of the current web request. 当前Web请求的执行期间生成了未处理的异常。 Information regarding the origin and location of the exception can be identified using the exception stack trace below. 可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。

Stack Trace: 堆栈跟踪:

[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 [OutOfMemoryException:类型为'System.OutOfMemoryException'的异常。 +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34 System.Reflection.RuntimeAssembly.nLoad(AssemblyName文件名,字符串codeBase,证据程序集安全性,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔型throwOnFileNotFound,布尔型用于自省,布尔型抑制安全检查)+34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔型throwOnFileNotFound,布尔型用于自省,布尔型抑制安全检查)+152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77 System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString,证据AssemblySecurity,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,用于自省的布尔值)+77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16 System.Reflection.Assembly.Load(String assemblyString) +28 System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString,证据assemblySecurity,StackCrawlMark&stackMark,用于自省的布尔值)+16 System.Reflection.Assembly.Load(字符串assemblyString)+28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,布尔型starDirective)+38

[ConfigurationErrorsException: Exception of type 'System.OutOfMemoryException' was thrown.] [ConfigurationErrorsException:引发了'System.OutOfMemoryException'类型的异常。]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,布尔型starDirective)+752
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()+218 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)+130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)+170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()+91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath,Boolean&isRefAssemblyLoaded)+285
System.Web.Compilation.BuildManager.ExecutePreAppStart() +153 System.Web.Compilation.BuildManager.ExecutePreAppStart()+153
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParametershostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)+521

[HttpException (0x80004005): Exception of type 'System.OutOfMemoryException' was thrown.] [HttpException(0x80004005):引发了类型'System.OutOfMemoryException'的异常。]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9950728 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+9950728 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)+101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext上下文)+254

I have also tried changing the Enable 32-bit Applications in the IIS Application Pools to True but the System.BadImageFormatException error still persist. 我也尝试将IIS应用程序池中的“启用32位应用程序”更改为True,但System.BadImageFormatException错误仍然存​​在。 Greatly appreciated for any suggestions to solve this error. 非常感谢您提供解决此错误的任何建议。

BadImageFormatException usually means architecture conflits.. Like trying to install a 32 bit assembly with a x64 install util for example. BadImageFormatException通常意味着体系结构冲突。例如,像尝试使用x64 install util安装32位程序集。

Also in the pre-bind state information you can read this line: 同样,在预绑定状态信息中,您可以阅读以下行:

WRN: A partial bind occurs when only part of the assembly display name is provided. WRN:当仅提供部分程序集显示名称时,发生部分绑定。 WRN: This might result in the binder loading an incorrect assembly. WRN:这可能导致活页夹加载不正确的组件。

Which might indicate that you are not using a fully qualified name to load an assembly but just the type. 这可能表明您不是在使用标准名称来加载程序集,而是仅使用类型。 Try specifying the fully qualified name of the assembly you are trying to load. 尝试指定要加载的程序集的标准名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM