繁体   English   中英

无法加载文件或程序集-ASP.NET MVC应用

[英]Could not load file or assembly - asp.net mvc app

尝试使用Visual Studio 2010在MVC 3应用程序上工作。该应用程序编译良好。 但是,在运行时失败。

Could not load file or assembly 'InnVue.BOA.RoomControl' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.BadImageFormatException: Could not load file or assembly 'InnVue.BOA.RoomControl' or one of its dependencies. 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. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

程序集加载跟踪:以下信息有助于确定为什么无法加载程序集“ InnVue.BOA.RoomControl”。

=== Pre-bind state information ===
LOG: DisplayName = InnVue.BOA.RoomControl
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: InnVue.BOA.RoomControl | Domain ID: 10
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
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: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/KHAN/Documents/GitHub/innvue/InnVue.InnDesk/InnVue.InnDesk/InnVue.InnDesk/
LOG: Initial PrivatePath = C:\Users\KHAN\Documents\GitHub\innvue\InnVue.InnDesk\InnVue.InnDesk\InnVue.InnDesk\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\KHAN\Documents\GitHub\innvue\InnVue.InnDesk\InnVue.InnDesk\InnVue.InnDesk\web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from 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/KHAN/AppData/Local/Temp/Temporary ASP.NET Files/root/41f4bb6c/382c05ac/InnVue.BOA.RoomControl.DLL.
LOG: Attempting download of new URL file:///C:/Users/KHAN/AppData/Local/Temp/Temporary ASP.NET Files/root/41f4bb6c/382c05ac/InnVue.BOA.RoomControl/InnVue.BOA.RoomControl.DLL.
LOG: Attempting download of new URL file:///C:/Users/KHAN/Documents/GitHub/innvue/InnVue.InnDesk/InnVue.InnDesk/InnVue.InnDesk/bin/InnVue.BOA.RoomControl.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

堆栈跟踪为:

[BadImageFormatException: Could not load file or assembly 'InnVue.BOA.RoomControl' or one of its dependencies. 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 fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'InnVue.BOA.RoomControl' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   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.ExecutePreAppStart() +157
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): Could not load file or assembly 'InnVue.BOA.RoomControl' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9942412
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456

我已经确认:

InnVue.BOA.RoomControl.dll确实是64位dll

主项目也引用InnVue.BOA.RoomControl.dll引用的程序集。

有什么办法可以精确地找到中断的地方吗? 堆栈跟踪中提供的信息不是很明显。

用于测试程序集引用(如果已将其正确添加到带有复制本地的项目中)的简单测试是正确的。 尝试将发布版本部署到本地IIS,然后尝试运行项目。 可能是由于缺少程序集而导致您的应用程序无法运行,请在继续操作之前对其进行修复,然后打包并打包Web应用程序以在Azure上对其进行测试。

另外,我使用了程序集绑定日志查看器 ,它将准确地告诉您GAC或bin目录中不存在的缺少程序集。

下载链接: https : //msdn.microsoft.com/zh-cn/library/e74a18c4(v=vs.110).aspx

希望这可以帮助!

暂无
暂无

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

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