[英]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.