log4net issue

Topics: Developer Forum
Apr 17, 2009 at 12:25 PM
I build the n2cms website. I got the following error

Server Error in '/' Application.

Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

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.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

Line 24:         <n2:TabPanel ToolTip="1. Welcome" runat="server">
Line 25:             <h1>Install N2 CMS</h1>
Line 26: 			<p class='<%# Status.IsInstalled ? "ok" : "warning" %>'>
Line 27: 				<b> Advice: </b> <%# GetStatusText() %>
Line 28:             </p>

Source File: e:\Suresh Projects - 20080204\CodePlex\CMS\TemplatesSite\wwwroot\Edit\Install\Default.aspx    Line: 26

Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:

[FileLoadException: Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount) +0
   System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +214
   System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +211
   System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +122
   System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) +419
   System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) +90
   System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) +50
   N2.Definitions.DefinitionBuilder.ExecuteRefiners(IList`1 definitions) +130
   N2.Definitions.DefinitionBuilder.GetDefinitions() +23
   N2.Definitions.DefinitionManager..ctor(DefinitionBuilder builder, IItemNotifier notifier) +9

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
   System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +361
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, Type[] signature) +79
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, Object[] arguments, Type[] signature) +123

[ComponentActivatorException: ComponentActivator: could not instantiate N2.Definitions.DefinitionManager]
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, Object[] arguments, Type[] signature) +229
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) +49
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) +43
   Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) +10
   Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) +71
   Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) +70
   Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDependency(CreationContext context, ComponentModel model, DependencyModel dependency) +238
   Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver parentResolver, ComponentModel model, DependencyModel dependency) +453
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context, Type[]& signature) +255
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) +35
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) +43
   Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) +10
   Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) +71
   Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) +70
   Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments) +125
   Castle.MicroKernel.DefaultKernel.get_Item(Type service) +49
   Castle.Windsor.WindsorContainer.Resolve(Type service) +10
   Castle.Windsor.WindsorContainer.Resolve() +58
   N2.Engine.ContentEngine.Resolve() +49
   N2.Edit.Install._Default.get_CurrentInstallationManager() +29
   N2.Edit.Install._Default.get_Status() +19
   ASP.edit_install_default_aspx.__DataBind__control7(Object sender, EventArgs e) in e:\Suresh Projects - 20080204\CodePlex\CMS\TemplatesSite\wwwroot\Edit\Install\Default.aspx:26
   System.Web.UI.Control.OnDataBinding(EventArgs e) +80
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +198
   System.Web.UI.Control.DataBind() +12
   System.Web.UI.Control.DataBindChildren() +214
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +208
   System.Web.UI.Control.DataBind() +12
   System.Web.UI.Control.DataBindChildren() +214
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +208
   System.Web.UI.Control.DataBind() +12
   System.Web.UI.Control.DataBindChildren() +214
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +208
   System.Web.UI.Control.DataBind() +12
   N2.Edit.Install._Default.OnPreRender(EventArgs e) +19
   System.Web.UI.Control.PreRenderRecursiveInternal() +88
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5676


I downloaded 1.2.9.0 from log4net site and placed in bin. Then i got the following error

Server Error in '/' Application.

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

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.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:

[FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   NHibernate.Cfg.Configuration..cctor() +0

[TypeInitializationException: The type initializer for 'NHibernate.Cfg.Configuration' threw an exception.]
   NHibernate.Cfg.Configuration..ctor() +0
   N2.Persistence.NH.ConfigurationBuilder.BuildConfiguration() +23
   N2.Persistence.NH.ConfigurationBuilder.BuildSessionFactory() +4
   N2.Persistence.NH.SessionProvider..ctor(IConfigurationBuilder builder, IInterceptor interceptor, IWebContext webContext) +17

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
   System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +361
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, Type[] signature) +79
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, Object[] arguments, Type[] signature) +123

[ComponentActivatorException: ComponentActivator: could not instantiate N2.Persistence.NH.SessionProvider]
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, Object[] arguments, Type[] signature) +229
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) +49
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) +43
   Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) +10
   Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) +71
   Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) +70
   Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDependency(CreationContext context, ComponentModel model, DependencyModel dependency) +238
   Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver parentResolver, ComponentModel model, DependencyModel dependency) +453
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context, Type[]& signature) +255
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) +35
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) +43
   Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) +10
   Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) +71
   Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) +70
   Castle.MicroKernel.Handlers.DefaultGenericHandler.Resolve(CreationContext context) +105
   Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDependency(CreationContext context, ComponentModel model, DependencyModel dependency) +238
   Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver parentResolver, ComponentModel model, DependencyModel dependency) +453
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context, Type[]& signature) +255
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) +35
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) +43
   Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) +10
   Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) +71
   Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) +70
   Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDependency(CreationContext context, ComponentModel model, DependencyModel dependency) +238
   Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver parentResolver, ComponentModel model, DependencyModel dependency) +453
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context, Type[]& signature) +255
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) +35
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) +43
   Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) +10
   Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) +71
   Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) +70
   Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments) +125
   Castle.MicroKernel.DefaultKernel.get_Item(String key) +68
   N2.Engine.ContentEngine.StartComponents(IKernel kernel) +230
   N2.Engine.ContentEngine.Initialize() +80
   N2.Context.Initialize(Boolean forceRecreate) +60
   N2.Web.InitializerModule.Init(HttpApplication context) +38
   System.Web.HttpApplication.InitModulesCommon() +67
   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +814
   System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +259
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +109
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +343


Can any one help me to sort this problem


Coordinator
Apr 18, 2009 at 8:58 PM
It appears log4net.dll is removed from the bin folder for some obscure reason. Are you using the web site project model? The file should be in the release you downloaded. Try putting it back and referencing it. Also if you find out why please let us know.
Apr 20, 2009 at 4:58 AM
Thank you very much for your quick response. The log4net.dll is available in the bin folder. I am using the website project model.

I am using some custom templates in my website. I am getting this error, when there is an  an error in the custom template.
We also used some dlls build by us in the custom templates.