Error - Activation error occurred while trying to get instance of type database key. (Require urgent help)

Topics: Data Access Application Block, Enterprise Library Core, General discussion
Mar 25, 2015 at 12:24 PM
Edited Mar 25, 2015 at 1:22 PM
I am receiving below error, it happen when trying to call Database property to connect to database (below).
I tried searching this on the internet but didn’t find much and suggested solution on the internet has already been used.
Also I’ve raised this issue on couple of relevant forums

I am using Enterprise Library 5.0
Visual Studio 2010 and .Net Framework 4.0
IIS version 7.5

but there were no response over there. As its very high priority and I am still facing same issue.
Also My code work perfect when running in in build server of Visual Studio 2010 but when I published in IIS and run it through IIS, I face this issue.
It’s very strange as its working fine through Visual Studio but not when published in IIS and I don’t see any issue in the code as gone through different resolutions mentioned.

Activation error occurred while trying to get instance of type database key through connection string
• The type Database cannot be constructed. You must configure the container to supply this value.
 Relevant Code Behind (Property)
public static Database Database
        return DatabaseFactory.CreateDatabase();
 Relevant Web.Config
<configuration xmlns="">
<!-- Default Enterprise Library Logging Configuration --> <configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <qualifyAssembly partialName="Microsoft.Practices.EnterpriseLibrary.Data" fullName="Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  <qualifyAssembly partialName="Microsoft.Practices.EnterpriseLibrary.Logging" fullName="Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  <qualifyAssembly partialName="Microsoft.Practices.EnterpriseLibrary.Common" fullName="Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<dataConfiguration defaultDatabase="QOS"/>
<add name="QOS" connectionString="Data Source=DV8;Initial Catalog=pos;UID=sa;pwd=pwd" providerName="System.Data.SqlClient"/>
<add name="Ter" connectionString="Data Source=DV8;Initial Catalog=Tn;UID=sa;pwd=pwd" providerName="System.Data.SqlClient"/>
<add name="Pon" connectionString="Data Source=DV8;Initial Catalog=pon;UID=sa;pwd=pwd" providerName="System.Data.SqlClient"/>

Please let me know if you require any further details.