EnterpriseLibrary - Help

Last post 08-12-2009 5:04 AM by kosmosniks. 2 replies.

Sort Posts:

  • EnterpriseLibrary - Help

    04-10-2009, 9:53 AM
    • Member
      123 point Member
    • arunveerappan
    • Member since 03-06-2008, 11:53 PM
    • Chennai
    • Posts 145

    Hi Members,

    When i run my application in 2.0 FrameWork I get the below message. This is bugging mr for past one week. Kindly, help me if you'd confronted this error in your project.

    Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code

    Exception Details: System.InvalidCastException: Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings'.

    Line 36: 							throw new Exception("Erorr creating IMapperRegistry from configuration file. Check the configuration key "+iMapperRegistryConfigKey);
    Line 37: 						}
    Line 38: 						Logger.Write("MapperRegistryAccessor:Successfully created registry from config key "+iMapperRegistryConfigKey,"Domain",1,0,Severity.Information);
    Line 39: 					}
    Line 40: 			///	}

    Source File: D:\Josh BAHD Copy on_02222009\Qwest\Qwest.Infrastructure\Qwest.Infrastructure.Common\Domain\Mappers\MapperRegistryAccessor.cs    Line: 38
    Stack trace:
    [InvalidCastException: Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings'.]
       Microsoft.Practices.EnterpriseLibrary.Logging.LoggingConfigurationView.GetLoggingSettings() in c:\EnterpriseLibrary\EnterpriseLibrary\Logging\LoggingConfigurationView.cs:65
       Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.Write(LogEntry log) in c:\EnterpriseLibrary\EnterpriseLibrary\Logging\LogWriter.cs:83
       Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(Object message, String category, Int32 priority, Int32 eventId, Severity severity, String title, IDictionary properties) in c:\EnterpriseLibrary\EnterpriseLibrary\Logging\Logger.cs:201
       Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(Object message, String category, Int32 priority, Int32 eventId, Severity severity) in c:\EnterpriseLibrary\EnterpriseLibrary\Logging\Logger.cs:119
       Qwest.Infrastructure.Common.Domain.Mappers.MapperRegistryAccessor.get_MapperRegistry() in D:\Josh BAHD Copy on_02222009\Qwest\Qwest.Infrastructure\Qwest.Infrastructure.Common\Domain\Mappers\MapperRegistryAccessor.cs:38
       Qwest.Infrastructure.Common.Domain.DomainObject.GetMapper(Type entityType) in D:\Josh BAHD Copy on_02222009\Qwest\Qwest.Infrastructure\Qwest.Infrastructure.Common\Domain\DomainObject.cs:292
       Qwest.Infrastructure.Common.Domain.DomainObject.Find(String entityName, String description, Type entityType) in D:\Josh BAHD Copy on_02222009\Qwest\Qwest.Infrastructure\Qwest.Infrastructure.Common\Domain\DomainObject.cs:264
       Qwest.Infrastructure.Common.Domain.Contacts.Contact.FindContact(String login) in D:\Josh BAHD Copy on_02222009\Qwest\Qwest.Infrastructure\Qwest.Infrastructure.Common\Domain\Contacts\Contact.cs:350
       Qwest.Infrastructure.Common.Domain.Contacts.Contact.FindContactByExactCUID(String cuid) in D:\Josh BAHD Copy on_02222009\Qwest\Qwest.Infrastructure\Qwest.Infrastructure.Common\Domain\Contacts\Contact.cs:355
       Qwest.BAHD.BL.Contacts.BAHDContact.FindContactByExactCUID(String cuid) in D:\Josh BAHD Copy on_02222009\Qwest\Qwest.BAHD\SRC\Qwest.BAHD.BL\Contacts\BAHDContact.cs:99
       Qwest.BAHD.BL.Contacts.BAHDContact.set_CurrentContact(BAHDContact value) in D:\Josh BAHD Copy on_02222009\Qwest\Qwest.BAHD\SRC\Qwest.BAHD.BL\Contacts\BAHDContact.cs:47
       Qwest.BAHD.UI.Global.Application_AcquireRequestState(Object sender, EventArgs e) in D:\Josh BAHD Copy on_02222009\Qwest\Qwest.BAHD\SRC\Qwest.BAHD.UI\Global.asax.cs:305
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
    

     

    I've Copied my browser text for your reference. Please help.

    Arun




    Arun
  • Re: EnterpriseLibrary - Help

    04-10-2009, 10:52 AM
    • Contributor
      7,249 point Contributor
    • whighfield
    • Member since 01-02-2006, 10:37 PM
    • Winterpeg, Manitoba
    • Posts 1,205

    Do you have more than one version of the ent lib on your machine?  If so you may want to make sure that the version number in the ent lib configuration settings in the web.config is the same you are referencing.

    You can also try this, first remove the references to the ent lib, save the project/solution, close VS, delete all of the bin/obj folders where these dlls might be in, open VS and your project, re-reference the ent lib and try it again.

    Hopefully this works

    Please mark the most helpful reply/replies as "Answer".

    - William
    http://thefrozencoder.ca
  • Re: EnterpriseLibrary - Help

    08-12-2009, 5:04 AM
    • Member
      4 point Member
    • kosmosniks
    • Member since 11-06-2007, 5:19 AM
    • Springs, South Africa
    • Posts 2
    1. Check your project to see if you are referencing the correct EntLib version.
    2. Check that if your project are referencing other projects that the other projects are also referencing the latest version of your EntLib or that they are at least in sync e.g. 4.1.0.0.
    3. Now ensure that the EntLib assemblies are in the write place, in other words the EntLib assemblies should either be in the local bin folder or in GAC.
    4. It is also possible that you are using one of the assemblies and they might be dependent on other EntLib assemblies. 
    5. If you use more than on version of EntLib I would suggest creating two folders one for 3.1 and one for 4.1 and then use the GAC as the main source, because you can run multiple versions of the same assembly in GAC but not in your bin folder.
    6. If you still have the problem start checking your configuration files. This part usually turns out to be the culprit.
    7. First check app.config then web.config and last but not least your machine.config, especially if you have upgraded from one version to another. You can find the the machine.config in c:\windows\microsoft.net\frameworks\v2.0*\CONFIG.
    8. When looking at the machine.config check the right framework folder as you might be running 64 bit.
    9. It could also be that you run on load balanced servers then you would have to go through the whole procedure for each server. 
Page 1 of 1 (3 items)