The connection string for the database 'Test' does not exist or does not have a valid provider.

Feb 24, 2014 at 10:53 PM
I have a very wired issue hosting a service on IIS.

I created a library TestLibrary and tested the functionality and than deployed on IIS.

Now when I try to access it, it shows below message

The connection string for the database 'Test' does not exist or does not have a valid provider.

and my connection string is correct and it has the provider too and I am able to test it with I run through IIS Express.
<add name="TestConnection" connectionString="Data Source=SERVER;Initial Catalog=DatabaseNAME;User ID=UID;Password=PWD" providerName="System.Data.SqlClient" />
Also could this be related to Entity Lib 6?

Can anyone please help?
Feb 24, 2014 at 10:55 PM
Edited Feb 24, 2014 at 10:56 PM
Also could there is something related to this. This is OLD connection string from the application which I am moving to Ent lib

Provider=SQLOLEDB;Data Source=.;database=EFS;uid=sa;pwd=nsaini;

Feb 26, 2014 at 6:35 AM
Based on the posted message it looks like the code is requesting a database with a connection string called "Test" but the connection string in the configuration file is called "TestConnection".

Randy Levy
Enterprise Library support engineer
Support How-to
Aug 14, 2014 at 6:38 AM
Edited Aug 14, 2014 at 6:41 AM
I get the exact same message by my configurations are a little more complicated: I'm using EF5 with Oracle managed data access provider. I think the configuration of the Oracle managed provider is messing up the EntLib. Here are the relevant parts of my config file:

 <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
      <add name="Database Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        databaseInstanceName="CroEntities" writeLogStoredProcName="WriteLog"
        addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
        traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
<dataConfiguration defaultDatabase="CroEntities" />
    <add name="CroEntities" connectionString="metadata=res://*/CroModel.csdl|res://*/CroModel.ssdl|res://*/CroModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=oracle;PASSWORD=pwd;PERSIST SECURITY INFO=True;USER ID=usr&quot;"
      providerName="System.Data.EntityClient" />
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <version number="">
        <dataSource alias="oracle" descriptor="(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521)))(CONNECT_DATA =(SERVICE_NAME =" />
The DB configuration works fine with EF5 and I have no problems to connect to the Oracle DB. However when I run the following code:
DatabaseFactory.SetDatabaseProviderFactory(new DatabaseProviderFactory());
LogWriterFactory logWriterFactory = new LogWriterFactory();
LogWriter defaultWriter = logWriterFactory.Create();
The code fails on the last line with "The connection string for the database 'CroEntities' does not exist or does not have a valid provider."
Any ideas how I might be able to solve this?

Thank you,
Aug 14, 2014 at 7:04 AM
The Data Access Application Block is a wrapper over ADO.NET so I don't think it's going to work with a provider of type System.Data.EntityClient. Also, I don't think there is a EntLib database implementation for the Oracle.ManagedDataAccess.Client provider. The built-in OracleDatabase is deprecated and uses System.Data.OracleClient while the EntLibContrib OralceDatabase uses the Oracle.DataAccess.Client provider. See this work item from EntLibContrib: Managed ODP.NET Support (Oracle.ManagedDataAccess).

Randy Levy
Enterprise Library support engineer
Support How-to
Aug 14, 2014 at 7:29 AM
Hi Randy and thank you for your quick response.
Seems like my best option is to switch to the event viewer listener until this issue is resolved
Thank you,

Sent from my Windows Phone