Last post Nov 28, 2014 08:49 AM by Rion Williams
Nov 28, 2014 07:42 AM|RiazP-MSDN|LINK
When trying to debug an ASP.NET application I keep getting an exception thrown when this line of code is executed -
Database db = DatabaseFactory.CreateDatabase();
The exception detail is as follows -
[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=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'.
Type B originates from 'Microsoft.Practices.EnterpriseLibrary.Common, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\126.96.36.199__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'.
Any ideas as to how resolve this issue?
Nov 28, 2014 08:49 AM|Rion Williams|LINK
It sounds like you have two separate references to the Microsoft.Practices.EnterpriseLibrary. Common assembly within your project. You might want to check under the references in your application to verify this and remove one of them if there are multiple.
You might also check if two of these references are present within your web.config file as well and remove one of them.