简体   繁体   English

Elmah MySql Nuget包问题'无法加载文件或程序集'

[英]Elmah MySql Nuget Package Issue 'Could not load file or assembly'

I'm trying to add Elmah to my MVC3 project. 我正在尝试将Elmah添加到我的MVC3项目中。 After installing via Nuget, when I try to access elmah (via localhost:port/elmah.axd ), I get an error containing this: 通过Nuget安装后,当我尝试访问elmah(通过localhost:port/elmah.axd )时,出现包含此错误的错误:

Could not load file or assembly 'MySql.Data, Version=6.1.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.

I've removed the mysql.data dll and added my own copy (version 6.4.4.0 - the documentation says you can override the dll provided with a newer version), but this error remains. 我删除了mysql.data dll并添加了我自己的副本(版本6.4.4.0 - 文档说你可以覆盖新版本提供的dll),但是这个错误仍然存​​在。 Has anyone else encountered this? 有人遇到过这种情况么?

My solution was to add this to my web.config: 我的解决方案是将其添加到我的web.config:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity 
          name="MySql.Data" 
          publicKeyToken="c5687fc88969c44d" 
          culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.4.4.0" newVersion="6.4.4.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

This basically says to the compiler that whenever something requests a version of the MySql.Data assembly that's between versions 0.0.0.0 and 6.4.4.0, it should instead be supplied with the version 6.4.4.0 assembly instead. 这基本上告诉编译器,只要有什么东西请求版本0.0.0.0和6.4.4.0之间的MySql.Data程序集的版本,它应该改为提供版本6.4.4.0程序集。

暂无
暂无

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

相关问题 “‘无法加载文件或程序集‘Elmah’或其依赖项之一。在 NuGet 中使用 Elmah.MVC 后,系统找不到指定的文件” - "'Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified'' after using Elmah.MVC in NuGet 无法为 NET Standard 加载 NuGet 包的文件或程序集异常 NET 5/6 - could not load file or assembly exception NET 5/6 of NuGet package for NET Standard Nuget包引用导致“无法加载文件或程序集”? - Nuget package references cause “Could not load file or assembly” ? C# 无法加载文件或程序集:NuGet - C# Could not load file or assembly : NuGet 使用NHUnspell NuGet包时无法加载文件或程序集Hunspellx64.dll? - Could not load file or assembly Hunspellx64.dll while using NHUnspell NuGet package? 安装MVC论坛Nuget包后无法加载文件或程序集&#39;Ninject.Web&#39; - Could not load file or assembly 'Ninject.Web' after Install MVC Forum Nuget Package nuget 包重定向后无法加载文件或程序集“System.Runtime.InteropServices.RuntimeInformation” - Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation' after nuget package retargetting 无法加载文件或程序集 ICSharpCode.SharpZipLib... 当使用 nuGet 包 ExcelDataReader - Could not load file or assembly ICSharpCode.SharpZipLib… When using nuGet package ExcelDataReader '无法加载文件或程序集。 系统找不到指定的文件' - 打包后抛出 .NET 框架 NuGet package - 'Could not load file or assembly. The system cannot find the file specified' - thrown after packaging .NET Framework NuGet package 来自 NuGet package 的运行时异常引用类型:'无法加载文件或程序集'Foo'。 该系统找不到指定的文件。' - Runtime exception referencing type from a NuGet package: 'Could not load file or assembly 'Foo'. The system cannot find the file specified.'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM