Enterprise Library Exception Handling Block Change between VS 2008 and VS2012

230 Views Asked by At

I have migrated my asp.net web application from Visual Studio 2008 to Visual Studio 2012. It is working except one case.

Some place they capture exception and throw it which is captured in Global.asax in Application_Error Event. This error is shown in Custom Error Page. It works in VS2008 but in VS 2012 it shows following error when we debug.

An exception of type 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingExcep> tion' occurred in Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll > but was not handled in user code

Additional information: Could not load file or assembly >'Microsoft.Practices.Unity, Version=2.0.414.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)

If there is a handler for this exception, the program may be safely continued.

The above error is raised in ExceptionPolicy.HandleException(error, "OIMPolicy") statement.

 protected void Application_Error(Object sender, EventArgs e)
        {
            Exception error = Server.GetLastError();

if (error != null) { Server.ClearError(); if (error.InnerException != null) error = error.InnerException; ExceptionPolicy.HandleException(error, "Policy"); } }

The above code works with old enterprise library on VS 2008. But it does not work in VS2012.

Can anyone suggest what enterprise library to use on VS 2012 or what is the fix for the above.

0

There are 0 best solutions below