【问题标题】:Elmah MySql Nuget Package Issue 'Could not load file or assembly'Elmah MySql Nuget 包问题“无法加载文件或程序集”
【发布时间】:2012-01-08 03:16:25
【问题描述】:

我正在尝试将 Elmah 添加到我的 MVC3 项目中。通过 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.

我已经删除了 mysql.data dll 并添加了我自己的副本(版本 6.4.4.0 - 文档说您可以覆盖更新版本提供的 dll),但此错误仍然存​​在。有没有其他人遇到过这种情况?

【问题讨论】:

    标签: c# mysql nuget elmah


    【解决方案1】:

    我的解决方案是将其添加到我的 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>
    

    这基本上告诉编译器,每当有东西请求一个版本介于 0.0.0.0 和 6.4.4.0 之间的 MySql.Data 程序集版本时,它应该改为提供版本 6.4.4.0 程序集。

    【讨论】:

      猜你喜欢
      • 2016-06-28
      • 2019-08-01
      • 2021-10-23
      • 2019-12-02
      • 1970-01-01
      • 2021-05-29
      • 2013-08-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多