2012-01-08 68 views
3

我正在嘗試將Elmah添加到我的MVC3項目中。通過的NuGet安裝後,當我嘗試訪問ELMAH(通過localhost:port/elmah.axd),我得到含有這樣的錯誤:Elmah MySql Nuget包問題'無法加載文件或程序集'

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),但是這個錯誤依然存在。有人遇到過這種情況麼?

回答

5

我的解決辦法是把它添加到我的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> 

這基本上說來,每當一些請求版本MySql.Data組件0.0.0.0版本和6.4.4.0之間的編譯器,它應該改爲提供版本6.4.4.0程序集。

相關問題