Enterprise Library data access block can't find connection

Topics: Data Access Application Block
Feb 21, 2011 at 3:43 PM

Okay, this is getting a little frustrating.  I've deployed a solution that worked fine on test, but on production gives an error saying it can't find the connection.  The solution uses the Enterprise Library 4.1 data access block to connect to a database, but on produciton an error stating "The requested database ... is not defined in configuration." is occuring.  The connection string is definitely present and the only difference between the configuration files is the server being connected to.

I am deploying the following:

Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.ObjectBuilder2.dll
Microsoft.Practices.Unity.dll

The unity assembly isn't actually being used.  There is no configuration specified other than the connection string which according to the documentation means it should go with defaults.  Unless I'm missing an assembly I don't understand why it wouldn't find the connection string and work without issues, but I can't determine what other assemblies would be required.

Feb 22, 2011 at 2:00 AM

The error message states that the supplied connection string name in the DatabaseFactory.CreateDatabase("testDb"); does not exist in the configuration. Are you sure you have checked that there are no any typo between the connection string name configured in the configuration and to what are you supplying in your code behind?

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com