Activation error occured while trying to get instance of type Database, key "myDatabaseName"

Topics: Data Access Application Block
Sep 12, 2011 at 7:16 PM

Hi all... I've been searching this on the internet, trying to get a solution to this issue, have noticed that some people have had success in getting this resolved.

I have an application using EntLib 5.0.

Here are some key config settings, this is not my full config file.

  <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" />
  </configSections>
  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="ExceptionCategory">
      Leaving out logging info as it's not important to my issue.
  </loggingConfiguration>

  <connectionStrings>
    <add name="LOCALHOST-LMSETL" connectionString="Database=LMSETL;Server=OurServerName\zone01,3180;Integrated Security=true;Connection Timeout=300" providerName="System.Data.SqlClient" />
    <add name="DEV-LMSETL" connectionString="Database=LMSETL;Server=OurServerName\zone01,3180;Integrated Security=true;Connection Timeout=300" providerName="System.Data.SqlClient" />
  </connectionStrings>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>
  <system.web>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
      </providers>
    </roleManager>
  </system.web>

 

The odd thing is, when running the application on my local laptop, the application runs fine.  However, when I package things up, create an Install app for it, run the install app on our server, I get the error in the title of the post.

The section of code that it's failing on is

database = DatabaseFactory.CreateDatabase( configurationName );
Where configurationName is the connection string. 

Some key points
* The entLib 5.0 library is being consumed by a custom DLL I wrote.
* The DLL I wrote is being consumed by a Windows Service.
* The Windows service has all the app.config data.
* I've ensured that the proper DLLs are being packaged properly.
* We are NOT using the GAC, rather all DLLs will be ran from the applications own directory.
* I've ensured that all DLLs are present after the install.
* I've ensured that the config file is present after the install.
* I've ensured that my all my code and what not are using the full .net 4.0 version and not the client/compact version.
* Developed on a Windows 7 machine.
* Developed against 32bit.
* Installed on Windows 2003 Server.

 

Any help is greatly appreciated! 

Rick

 

 

Sep 12, 2011 at 11:29 PM

Hi Rick,

Please take a look at this page for Ent Lib 5;

http://msdn.microsoft.com/en-us/library/ff632023.aspx

Your server, Windows Server 2003, is not supported :-(