0

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

 [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'.

有什么方法可以在我的应用程序中使用升级后的身份验证模块而不升级到 EL 5.0?

4

1 回答 1

1

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

于 2012-01-19T16:57:16.257 回答