Activation error occured while trying to get instance of type ExceptionPolicyImpl, key "DataAccessPolicy"

Topics: Data Access Application Block, Exception Handling Application Block, Logging Application Block
Apr 6, 2012 at 6:14 AM

Hai,

    I have the above error annoying my application. I would like to mention the below details for it,

Application Type  : Asp.net

Config File Name  : Web.config

Description           : I get sql exception, I handled it via Microsoft.Practices.EnterpriseLibrary.ExceptionHandling..ExceptionPolicy.HandleException(ex, "DataAccessPolicy");  function throws an unhandled exception again.

    The thread similar to this problem is [discussion:243385], but it for WPF app. Please help out to understand the problem and solve it.

 

With Regards,

Arun kumar.

Apr 8, 2012 at 7:16 AM

The Activation Error usually means that the policy "DataAccessPolicy" is not configured in web.config.  Verify that the web.config file for the application contains the appropriate configuration section.  It would look something like:

    <configSections>
        <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" />
    </configSections>
    <exceptionHandling>
        <exceptionPolicies>
            <add name="DataAccessPolicy">
                <exceptionTypes>
...
                </exceptionTypes>
            </add>
        </exceptionPolicies>
    </exceptionHandling>

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

Apr 10, 2012 at 7:41 AM
randylevy wrote:

The Activation Error usually means that the policy "DataAccessPolicy" is not configured in web.config.  Verify that the web.config file for the application contains the appropriate configuration section.  It would look something like:

    <configSections>
        <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" />
    </configSections>
    <exceptionHandling>
        <exceptionPolicies>
            <add name="DataAccessPolicy">
                <exceptionTypes>
...
                </exceptionTypes>
            </add>
        </exceptionPolicies>
    </exceptionHandling>

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

 

Message : Resolved with another solution

Thanks @randylevy

, even after trying out your solution I found the same error. The better part is that the problem is resolved with the following solution.

I tried updating an entity by creating a new entity and assigned the values to it, then update in dbcontext. This showed the above exception.

Now I first got the entity from dbcontext by using the id column and changed the values, then update in dbcontext. Problem soved :).

Is there any explanation for it.

 

With Regards,

Arun kumar M.