我有一个实体框架项目,它在我的机器上运行良好,但从网络运行时会崩溃。最近对该项目的更改包括添加 Dynamic Linq dll (System.Linq.Dynamic)
当我从网络调试它时,VS 报告: The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception
内部异常是:“无法加载文件或程序集 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(来自的异常HRESULT: 0x80131040)":"EntityFramework,版本=4.4.0.0,文化=中性,PublicKeyToken=b77a5c561934e089"}
我尝试了通常的技巧:packages
从项目的根目录中删除目录,从包管理器控制台卸载并重新安装,但无济于事。
我的 app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="LGFinance.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="LGFinanceEntities" connectionString="metadata=res://*/Model.LGFinanceContext.csdl|res://*/Model.LGFinanceContext.ssdl|res://*/Model.LGFinanceContext.msl;provider=System.Data.SqlClient; provider connection string='data source=lightning;initial catalog=DLGDB;Integrated Security=true;Password=******;multipleactiveresultsets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<applicationSettings>
<LGFinance.Properties.Settings>
<setting name="Setting" serializeAs="String">
<value />
</setting>
</LGFinance.Properties.Settings>
</applicationSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
有人可以指出我做错了什么吗?