在Web应用程序中加载文件或程序集出错

时间:2015-08-28 13:46:28

标签: asp.net .net web web-applications .net-assembly

我需要一些亲的帮助, 我试图在我的服务器上安装DevInfo 7 Web应用程序,有很多SQL Server和IIS的问题,2天后,我设法修复它,但现在IIS和SQL工作正常,我可以&因为我对这种语言一无所知(顺便说一下,我会添加一些标签,但由于我不知道这种语言,我不确定它们是否真的与问题相关,如果我选择了一个错误的标签,请告诉我我接受它!)

如果有人可以向我解释错误或如何修复它,我将不胜感激,因为我没有创建Web应用程序(我不知道如何这样做),以及只是试图安装一个,我可能不明白(请尽量简单)

我不知道如果这会改变某些东西,但我将它安装在Windows Server 2012,x64上......

这是错误:

' / devinfo'中的服务器错误应用

无法加载文件或程序集' DI5_INIFile'或其中一个依赖项。尝试加载格式不正确的程序。   描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.BadImageFormatException:无法加载文件或程序集' DI5_INIFile'或其中一个依赖项。试图加载格式不正确的程序。

来源错误:

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

装配负载跟踪:以下信息有助于确定装配' DI5_INIFile'无法加载。

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 is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

堆栈追踪:

[BadImageFormatException: Could not load file or assembly 'DI5_INIFile' 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.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

[ConfigurationErrorsException: Could not load file or assembly 'DI5_INIFile' 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) +12761078
   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) +203
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'DI5_INIFile' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881540
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722601

1 个答案:

答案 0 :(得分:2)

听起来好像你已经进入了.net Version Hell。当存在冲突的dll版本时,我遇到了这个问题。

要尝试的事情: 1 - 清理解决方案(右键单击Visual Studio中解决方案树的顶部,然后单击"清理"),然后执行全部重建。

2 - 如果这不起作用,请清除项目的../bin/Debug文件夹,然后重复步骤1.如果这是一个Web应用程序并且您运行了本地版本的IIS,那么应该考虑首先进行IIS重置。这将释放进程可能在bin文件夹中的dll上的任何锁定。

3-除了第2步之外,您还可以清除../obj文件夹。但是,清理和重建 应该为您执行此操作。

4 - 还有一件事要清除临时的asp.net文件: del / F / Q"%SystemRoot%\ Microsoft.NET \ Framework64 \ v4.0.30319 \ Temporary ASP.NET Files"

5 - 如果不这样做,您将需要查看哪个项目试图引用' DI5_INIFile'并检查其版本号(右键单击dll>属性>版本),看看它是否在您的web.config下的版本号不同。 如果是,您可以从项目中删除引用的程序集,并尝试重新添加它。

希望有所帮助!