I'm trying to use Enterprise Library to handle all my exceptions, and I've followed the tutorials on the internet, but I keep getting the same error. So, after 2 days of googling and looking for ways to fix the error, I come to you guys for ideas/solutions.
This is the xml that I generated using Enterprise Library Configuration and following the tutorials:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="enterpriselibrary.configurationSettings" type="EnterpriseLibraryHelper.ConfigurationManagerSectionHandler, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<exceptionHandling>
<exceptionPolicies>
<add name="Exception Policy">
<exceptionTypes>
<add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
postHandlingAction="NotifyRethrow" name="Exception" />
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
<enterpriselibrary.configurationSettings xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" applicationName="Application" xmlns="
http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/configuration">
<configurationSections>
<configurationSection xsi:type="ReadOnlyConfigurationSectionData" name="loggingConfiguration" encrypt="false">
<storageProvider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="loggingConfiguration.config" />
<dataTransformer xsi:type="CustomTransformerData" name="Xml Serializer Transformer turbo" type="EnterpriseLibraryHelper.XmlSerializerTransformer, EnterpriseLibraryHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<Attributes name="serializerType" value="EnterpriseLibraryHelper.LoggingSettingsSerializer.XmlSerializationWriter1, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
<Attributes name="deserializerType" value="EnterpriseLibraryHelper.LoggingSettingsSerializer.XmlSerializationReader1, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
</dataTransformer>
</configurationSection>
<configurationSection xsi:type="ReadOnlyConfigurationSectionData" name="loggingDistributorConfiguration" encrypt="false">
<storageProvider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="loggingDistributorConfiguration.config" />
<dataTransformer xsi:type="CustomTransformerData" name="Xml Serializer Transformer turbo" type="EnterpriseLibraryHelper.XmlSerializerTransformer, EnterpriseLibraryHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<Attributes name="serializerType" value="EnterpriseLibraryHelper.DistributorSettingsSerializer.XmlSerializationWriter1, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
<Attributes name="deserializerType" value="EnterpriseLibraryHelper.DistributorSettingsSerializer.XmlSerializationReader1, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
</dataTransformer>
</configurationSection>
</configurationSections>
<keyAlgorithmStorageProvider xsi:nil="true" />
<includeTypes />
<exceptionHandling>
<exceptionHandlingConfiguration>
<xmlSerializerSection type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.1.0.0, Culture=neutral, PublicKeyToken=66c36a3abdf5268d">
<enterpriseLibrary.exceptionHandlingSettings xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/exceptionhandling">
<exceptionPolicies>
<exceptionPolicy name="Exception Policy">
<exceptionTypes>
<exceptionType name="Exception" type="System.Exception, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow">
<exceptionHandlers>
<exceptionHandler xsi:type="LoggingExceptionHandlerData" name="Logging Handler" defaultLogCategory="Trace" defaultEventID="100" defaultSeverity="Error" defaultTitle="Enterprise Library Exception Handling" formatterTypeName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.1.0.0, Culture=neutral, PublicKeyToken=66c36a3abdf5268d" minimumPriority="0" />
</exceptionHandlers>
</exceptionType>
</exceptionTypes>
</exceptionPolicy>
</exceptionPolicies>
</enterpriseLibrary.exceptionHandlingSettings>
</xmlSerializerSection>
</exceptionHandlingConfiguration>
<exceptionPolicies>
<add name="ExternalPolicy">
<exceptionTypes>
<add name="Exception" type="System.Exception, mscorlib" postHandlingAction="ThrowNewException">
<exceptionHandlers>
<add name="WrapHandler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WrapHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" exceptionMessage="Test Message" wrapExceptionType="System.ApplicationException, mscorlib" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
</enterpriselibrary.configurationSettings>
</configuration>
Invalid section name. The section 'exceptionHandlingConfiguration' does not exist in the requested configuration file 'C:\...\web.config' or the file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration section exists in one of the files and that the section 'exceptionHandlingConfiguration' is defined.
I am using C# in Microsoft Visual Studio to run this.
Posts
However, the section name in your configuration file is "enterpriselibrary.configurationSettings" and the one that the error message indicates should exist is "enterpriseLibrary.configurationSections".