0

我有一个使用企业库4.1的Web应用程序。一位同事将Web应用使用的认证模块升级到Enterprise Library 5.0。不幸的是,认证模块的升级版包含了我需要的新功能,所以我必须在我的项目中包含升级后的模块。现在我得到以下异常:企业库在Web应用程序中抛出异常

[A]Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection 
cannot be cast to [B]Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection. 
Type A originates from 'Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, 
PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 
'C:\Windows\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\4.1.0.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'. 
Type B originates from 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, 
PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 
'C:\Windows\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\5.0.414.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'. 

有什么办法,我可以用我的应用程序升级认证模块无需升级到5.0 EL?

回答

1

我不认为您可以同时在应用程序中同时使用两个版本的企业库,至少在使用配置文件时不会这样做。您看到的问题是由于5.0版尝试从应用程序的配置文件中读取4.1版的配置部分。

+0

是的,我基本上已经得出这个结论 - 或者至少没有人提出过替代方案。我想这是鼓励全组织升级的一种方法,但是我宁愿它是按照一致的时间表而发生的,而不是出乎意料。我还发现EntLib 5.0.414.0有一个与版本5.0.505.0中解决的entlib.config位置相关的错误。 – 2012-01-19 19:41:16

相关问题