Unable To Log To FlatFile: FileLoadException Thrown On Loading Microsoft.Practices.EnterpriseLibrary.ExceptionHandling

Topics: Exception Handling Application Block, Logging Application Block
Aug 16, 2012 at 6:03 PM
Edited Aug 16, 2012 at 6:20 PM

Greetings;

I have a simple .NET Console Task in which I'm trying to log exceptions to the FlatFile Text Listener.  I'm building and running my application under Windows XP Professional Version 5.1 (Build 2600.xpsp_sp3_gdr.120504-1619 : Service Pack 3) using the Enterprise Library 5.0 Framework.  My application was created under Visual Studio 2010 and targets the .NET Framework 4.  My application builds cleanly with no compile or link warnings, and the app.config file passes validation without any warnings using the Enterprise Library V5 Configuration Tool.

My console task project references the following DLLs from the Enterprise Library, and all are from the same source location and of the same version:

    Microsoft.Practices.EnterpriseLibrary.Common
    Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
    Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging
    Microsoft.Practices.EnterpriseLibrary.Logging
    Microsoft.Practices.EnterpriseLibrary.Logging.Database

At the point I attempt to log a caught exception to the FlatFile using the Exception Handling Application block, I receive runtime exception being thrown from within the Microsoft Enterprise Library classes of type System.Configuration.ConfigurationErrorsException with the error message "An error occurred creating the configuration section handler for exceptionHandling: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies."

Using the debug version of the Enterprise Libary 5.0 code, the System.Configuration.ConfigurationErrorsException with the FileLoadException InnerException refrence is being thrown from within ExceptionPolicy.GetExceptionPolicy(Exception exception, string policyName) method's catch (Exception ex) block.  The following are the contents of the outter System.Configuration.ConfigurationErrorsException with the System.IO.FileLoadException InnerException reference:

Outter Exception:

? ex.GetType().ToString()
"System.Configuration.ConfigurationErrorsException"

? ex.Message
"An error occurred creating the configuration section handler for exceptionHandling: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (C:\\MyConsoleApp\\RunMyConsoleApp\\bin\\Debug\\RunMyConsoleApp.vshost.exe.Config line 6)"

? ex.StackTrace
"at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource.DoGetSection(String sectionName)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileBasedConfigurationSource.GetSection(String sectionName)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConfigSectionLocator.GetRegistrationsInternal(IConfigurationSource configurationSource, Func`3 registrationsAccessor)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConfigSectionLocator.GetRegistrations(IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.CompositeTypeRegistrationsProviderLocator.<GetRegistrations>b__0(ITypeRegistrationsProvider l, IConfigurationSource cs)
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.ConfigureContainer(ITypeRegistrationsProvider locator, IContainerConfigurator configurator, IConfigurationSource configSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.ConfigureContainer(IContainerConfigurator configurator, IConfigurationSource configSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.CreateDefaultContainer(IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.CreateDefaultContainer()
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.SetCurrentContainerIfNotSet()
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.get_Current()
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.GetExceptionPolicy(Exception exception, String policyName)"

Inner Exception:

? ex.InnerException.GetType().ToString()
"System.IO.FileLoadException"

? ex.InnerException.Message
"Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

? ex.InnerException.StackTrace
"at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)"

? ((System.IO.FileLoadException)ex.InnerException).FileName
"Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Referencing the FileLoadException, the Enterprise Library assembly that could not be load, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll, has the following properties inside the Visual Studio properties tab:

(Name)                  Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
Aliases:                global
Copy Local:             True
Culture:
Description:            Enterprise Library Exception Handling Application Block
Embed Interop Types:    False
File Type:              Assembly   
Idendity:               Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
Path:                   C:\EntLib50Src\bin\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Resolved:               True
Runtime Version:        v2.0.50727
Specific Version:       False
Strong Name:            False
Version:                5.0.505.0

The Enterprise Library references in the app.config file are as follows:

  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  </configSections>

The <exceptionHandling> definition inside the app.config for FlatFile Exception Logging is as follows:

  <exceptionHandling>
    <exceptionPolicies>
      <add name="FlatFile Policy">
        <exceptionTypes>
          <add name="SystemException" type="System.SystemException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="None">
            <exceptionHandlers>
              <add name="Flat File Exception Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                logCategory="FlatFileException" eventId="1000" severity="Error"
                title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"
                priority="0" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
    </exceptionPolicies>
  </exceptionHandling>

In attempt to further identify the cause of the FileLoadException, I tried to analyze the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling load error using fuslogvw.exe, and have received the following entries specific to Microsoft.Practices.EnterpriseLibrary.ExceptionHandling:

*** Assembly Binder Log Entry  (8/16/2012 @ 11:40:20 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\RunMyConsoleApp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = Highbury\ClockEndGooner
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources, Version=5.0.505.0, Culture=en-US, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = RunMyConsoleApp.exe
Calling assembly : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\RunMyConsoleApp.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/en-US/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources.DLL.
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/en-US/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources.DLL.
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/en-US/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources.EXE.
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/en-US/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources.EXE.
LOG: All probing URLs attempted and failed.

*** Assembly Binder Log Entry  (8/16/2012 @ 11:40:20 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\RunMyConsoleApp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = Highbury\ClockEndGooner
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources, Version=5.0.505.0, Culture=en, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C://RunMyConsoleApp/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = RunMyConsoleApp.exe
Calling assembly : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\RunMyConsoleApp.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/en/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources.DLL.
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/en/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources.DLL.
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/en/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources.EXE.
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/en/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.resources.EXE.
LOG: All probing URLs attempted and failed.

*** Assembly Binder Log Entry  (8/16/2012 @ 11:40:17 AM) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\RunMyConsoleApp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = Highbury\ClockEndGooner
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = RunMyConsoleApp.exe
Calling assembly : System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\RunMyConsoleApp.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null
LOG: Binding succeeds. Returns assembly from C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll.
LOG: Assembly is loaded in default load context.

*** Assembly Binder Log Entry  (8/16/2012 @ 11:40:20 AM) ***

The operation failed.
Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\RunMyConsoleApp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = Highbury\ClockEndGooner
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = RunMyConsoleApp.exe
Calling assembly : System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\RunMyConsoleApp.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/RunMyConsoleApp/RunMyConsoleApp/bin/Debug/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\RunMyConsoleApp\RunMyConsoleApp\bin\Debug\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Based on the above information, any guideance or suggestions on how I can resolve this set of Microsoft.Practices.EnterpriseLibrary.ExceptionHandling errors and exceptions to log to a FlatFile would be greatly appreciated.

Thank you in advance for your time, help and patience.

Aug 16, 2012 at 8:38 PM

First off, thanks for posting such a thoroughly documented and complete question!

It looks like the runtime is attempting to resolve an unsigned version of Microsoft.Practices.EnterpriseLibrary.ExceptionHandling (i.e. Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null).  The configuration (and perhaps other references?) is referencing the signed versions.

Perhaps the project is still referencing some debug assemblies (which are not signed)?  Can you verify that all the Enterprise Library assembly references are set to the signed versions (i.e. Strong Name = true in reference properties)?

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

Aug 16, 2012 at 9:48 PM


Randy;

Thank you very much for your quick response and your compliments; both are very much appreciated.

I think you're setting me on the right track, as I was trying to use a local and unmodified source build of the Enterprise Library 5.0 Assemblies to debug and step through my application code.

Assembly / DLL:     Microsoft.Practices.EnterpriseLibrary.Common
Version:                5.0.505.0
Runtime Version:    v2.0.50727
Culture:                 Neutral
Public Key Token:   31bf3856ad364e35
Strong Name:        True

Assembly / DLL:     Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
Version:                5.0.505.0
Runtime Version:    v2.0.50727
Culture:                 Neutral
Public Key Token:   31bf3856ad364e35
Strong Name:        True

Assembly / DLL:     Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging
Version:                5.0.505.0
Runtime Version:    v2.0.50727
Culture:                 Neutral
Public Key Token:   31bf3856ad364e35
Strong Name:        True

Assembly / DLL:     Microsoft.Practices.EnterpriseLibrary.Logging
Version:                5.0.505.0
Runtime Version:    v2.0.50727
Culture:                 Neutral
Public Key Token:   31bf3856ad364e35
Strong Name:        True

Assembly / DLL:     Microsoft.Practices.EnterpriseLibrary.Logging.Database
Version:                5.0.505.0
Runtime Version:    v2.0.50727
Culture:                 Neutral
Public Key Token:   31bf3856ad364e35
Strong Name:        True

Since the Public Key Tokens, Versions, Runtime Versions, and Strong Name values for each of the Enterprise Libraries are the same and in "agreement", do you have an idea on what else is missing?

Also, just to take a step back and make sure I didn't miss the obvious, do you have any special notes or insights on how I can build a local and unmodified version of the Enterprise Library DLLs from the source debugging release from the MSDN Download link at http://www.microsoft.com/en-us/download/details.aspx?id=15104 for Enterprise Library 5.0 - Source Code.msi?

Again, my thanks for your time, help and patience...

 

Aug 16, 2012 at 10:47 PM

If you wish to use an Enterprise Library debug build you can add a reference to the Debug assemblies from the bin\Debug directory.  So in your case the dependent assemblies would be:

    Microsoft.Practices.EnterpriseLibrary.Common
    Microsoft.Practices.EnterpriseLibrary.Data
    Microsoft.Practices.EnterpriseLibrary.ExceptionHandling

    Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging
    Microsoft.Practices.EnterpriseLibrary.Logging
    Microsoft.Practices.EnterpriseLibrary.Logging.Database
    Microsoft.Practices.ServiceLocation
    Microsoft.Practices.Unity
    Microsoft.Practices.Unity.Configuration
    Microsoft.Practices.Unity.Interception
    Microsoft.Practices.Unity.Interception.Configuration

Then you would need to modify the configuration file because the debug assemblies do not have a strong name.  So basically this would mean replacing:

, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

with:

, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null

In terms of troubleshooting the issue, I would look in your application bin folder to ensure that the above assemblies are there.  Then you could check your application to verify the references.  To do this I would use ILDASM.  Then in the manifest you would see something like:

.assembly extern Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
{
  .publickeytoken = (31 BF 38 56 AD 36 4E 35 )                         // 1.8V.6N5
  .ver 5:0:505:0
}

So you can see that this is referencing the signed version.  You could then open each assembly in ILDASM to verify their signature or use the strong name tool:

sn -Tp  Microsoft.Practices.EnterpriseLibrary.Common

All assemblies should show as being strong named (or not depending on whether you are referencing the binary release or the debug build).  Also the version should match (if viewing in ILDASM) but that is not your issue but can sometimes occur if there are multiple versions of Enterprise Library installed.

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