EntLib 5.0 - Could not load file or assembly 'System.Data.OracleClient, Version=4.0.0.0 exception

Topics: Data Access Application Block
Oct 7, 2011 at 4:16 PM

I am using VS 2010, .NET framework 4.0 and EntLibrary 5.0

My application was running perfectly on my dev box which is 32 bit Win 7. Now I am trying to install my windows service application on 64 bit Windows Server 2008 with .Net 4.0.

When I start my service, this is the error I come across. Could not find a proper solution on the web so far. Here is the stack trace, App.Config and the code that is invoked.

Any suggestions?

      

  public static Database GetDBInstance()
        {
            var namedDB = EnterpriseLibraryContainer.Current.GetInstance("CirrusMessageServer");
            return namedDB;
        }

 

<?xml version="1.0"?>
<configuration>
    <configSections>
      <!--Enterprise library settings-->
      <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, 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" />
      <!--Enterprise library settings-->
      <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>     
    </configSections>

<enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source">
      <sources>
        <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </sources>
    </enterpriseLibrary.ConfigurationSource>
    <dataConfiguration defaultDatabase="CirrusMessageServer" />
    <connectionStrings>
      <add name="CirrusMessageServer" connectionString="Database=Cirrus_MessageServer_New;Server=(local);User Id=sa;Password=tempscott;"
          providerName="System.Data.SqlClient" />
    </connectionStrings>

</configuration>

 

 

System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
   --- End of inner exception stack trace ---
   at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.GetDefaultMapping(String dbProviderName)
   at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.GetDatabaseData(ConnectionStringSettings connectionString, DatabaseSettings databaseSettings) in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Configuration\DatabaseSyntheticConfigSettings.cs:line 155
   at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.<get_Databases>d__0.MoveNext() in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Configuration\DatabaseSyntheticConfigSettings.cs:line 94
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.<DoGetRegistrations>d__10.MoveNext() in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Configuration\DatabaseSyntheticConfigSettings.cs:line 323
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.GetRegistrations(IConfigurationSource configurationSource) in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Configuration\DatabaseSyntheticConfigSettings.cs:line 307
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.TypeLoadingLocator.GetRegistrationsInternal(IConfigurationSource configurationSource, Func`3 registrationAccessor)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.CompositeTypeRegistrationsProviderLocator.<>c__DisplayClass5.<GetRegistrationsInternal>b__4(ITypeRegistrationsProvider l)
   at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator.RegisterAllCore(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ChangeTrackingContainerConfigurator.RegisterAll(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.SetCurrentContainerIfNotSet()
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.get_Current()
   at Cirrus.Interface.DAL.DBManager.GetDBInstance() in C:\Code\IQ\Cirrus-Development\Cirrus.Interface.DAL\DBManager.cs:line 31
   at Cirrus.Interface.DAL.DBManager..cctor() in C:\Code\IQ\Cirrus-Development\Cirrus.Interface.DAL\DBManager.cs:line 24
   --- End of inner exception stack trace ---
   at Cirrus.Interface.DAL.DBManager.GetUnprocessedMessages()
   at

Oct 7, 2011 at 4:19 PM

I am trying to connect to MS SQL Server 2008. Not sure why is it showing the OracleClient dependency!

Oct 8, 2011 at 3:09 PM

Hi,

The issue looks really strange. I don't have any idea on the cause but maybe you are using different configuration file? Also, try it on a simple console application and let us know if you are able to reproduce it?

 

Noel Angelo Bolasoc
Avanade Software and Cloud Services
Avanade, Inc.
Contact 

 

Oct 11, 2011 at 9:23 PM

I was building the project by targeting full .NET 4.0 framework.

But the machine where I was installing this service had only the .NET 4.0 client framework.

Installed the full framework and it works as needed. Thanks.

Sep 28, 2012 at 1:19 PM
Edited Sep 28, 2012 at 1:20 PM

Hi,

 

Error Details:

Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I too have Same Error While Consuming WCf service from my Web Application during setup file creation.

I would be thakful if any one helped me

Sep 30, 2012 at 3:35 PM

The error means that the assembly Microsoft.Practices.EnterpriseLibrary.Common could not be found.  Ensure that the appropriate Enterprise Library assemblies have been deployed.

If you continue to have issues please start a new thread with your specific information -- thanks.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com