【问题标题】:Error loading file or assembly in Web Application在 Web 应用程序中加载文件或程序集时出错
【发布时间】:2015-11-23 04:57:22
【问题描述】:

我需要一些专业帮助, 我正在尝试在我的服务器上安装 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

【问题讨论】:

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


    【解决方案1】:

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

    要尝试的事情: 1 - 清理您的解决方案(右键单击 Visual Studio 中解决方案树的顶部,然后单击“清理”),然后执行 Rebuild All。

    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 下不同的版本号。 如果是,您可以从项目中删除引用的程序集并尝试重新添加它。

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-30
      • 1970-01-01
      相关资源
      最近更新 更多