we are using enterprise library 6.0- exceptional handling block and configuration console for defining policy.

The following code has been generated in app.config file for the defined policy



<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    </configSections>
    <exceptionHandling>
        <exceptionPolicies>
            <add name="DataAccessPolicy">
                <exceptionTypes>
                    <add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                        postHandlingAction="ThrowNewException">
                        <exceptionHandlers>
                            <add name="Replace Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ReplaceHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                                exceptionMessage="An occured in the data &#xD;&#xA;access layer.&#xD;&#xA;Please Contact the &#xD;&#xA;Admin with Error Id { }."
                                replaceExceptionType="Mindtree.Azure.PaymentGatewayExceptionHandler.DataAccessException, Mindtree.Azure.PaymentGatewayExceptionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
                        </exceptionHandlers>
                    </add>
                </exceptionTypes>
            </add>
        </exceptionPolicies>
    </exceptionHandling>
</configuration>


I have the following code in my catch block, i am defining manager using configuration source factory and setting the exception manager

            IConfigurationSource config = ConfigurationSourceFactory.Create();
            ExceptionPolicyFactory factory = new ExceptionPolicyFactory(config);
            ExceptionPolicy.SetExceptionManager(factory.CreateManager())
            bool rethrow = ExceptionPolicy.HandleException(ex,"DataAccessPolicy");
            if(rethrow)
            throw;
DataAccessPolicy is defined in the app.config file which uses the repalce handler

but the following error is thrown when debugging 

The configuration section for Exception Handling cannot be found in the configuration source.

Any Help would be appereciated. Thanks in advance
0

There are 0 answers