我在MVC中得到了以下错误
不能将AMicrosoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection转换为BMicrosoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection.类型A来源于'Microsoft.Practices.EnterpriseLibrary.Common,Version=5.0.414.0、Culture=neutral、PublicKeyToken=31bf3856ad364e35‘,位于location 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\5.0.414.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'.的上下文'Default’中类型B来源于'Microsoft.Practices.EnterpriseLibrary.Common,Version=6.0.0.0、Culture=neutral、PublicKeyToken=31bf3856ad364e35‘,位于location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\v4.0_6.0.0.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'.","ExceptionType":"System.InvalidCastException",的上下文'Default’“Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection.GetConfigurationSourceSection()\r\n at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceFactory.Create()\r\n”:“StackTrace”
请帮助解决这个问题。
发布于 2015-01-16 06:56:31
在企业库版本中,似乎存在版本冲突。
您应该能够通过将绑定重定向添加到web.config中的<runtime><assemblyBinding>下的后期版本来克服这个问题。
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Common"
culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>您可能需要以类似的方式重定向任何其他EntLib程序集。
https://stackoverflow.com/questions/27978613
复制相似问题