Server error in application

Topics: Customizing Orchard
Apr 15, 2013 at 2:31 PM
Friday I did finish an new site and tried to get it transferred to my hostin provider. When upload with FTP was finished, I was starting the site and I got an error (after setting customErrors on Off ):

Server Error in '/' Application.

Inheritance security rules violated while overriding member: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
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.TypeLoadException: Inheritance security rules violated while overriding member: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

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.

Stack Trace:


[TypeLoadException: Inheritance security rules violated while overriding member: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.]
log4net.Repository.Hierarchy.Hierarchy..ctor(ILoggerFactory loggerFactory) +0
log4net.Repository.Hierarchy.Hierarchy..ctor() +22

In this site i did use non-authentication to start de website and after login I do continue with the authenticated user.
I have no idea what the error message is an the site itself runs correct on my local computer.
Any ideas are very welcome. Thanks
Apr 15, 2013 at 3:03 PM
Folowing is the Stack Trace completly:

Stack Trace:

[TypeLoadException: Inheritance security rules violated while overriding member: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.]
log4net.Repository.Hierarchy.Hierarchy..ctor(ILoggerFactory loggerFactory) +0
log4net.Repository.Hierarchy.Hierarchy..ctor() +22

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
log4net.Core.DefaultRepositorySelector.CreateRepository(String repositoryName, Type repositoryType) +509
log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly repositoryAssembly, Type repositoryType, String repositoryName, Boolean readAssemblyAttributes) +457
log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly repositoryAssembly, Type repositoryType) +17
log4net.Core.DefaultRepositorySelector.GetRepository(Assembly repositoryAssembly) +42
log4net.Core.LoggerManager.GetLogger(Assembly repositoryAssembly, String name) +55
log4net.LogManager.GetLogger(Assembly repositoryAssembly, String name) +8
log4net.LogManager.GetLogger(String name) +20
Orchard.Logging.OrchardLog4netFactory.Create(String name) in OrchardLog4netFactory.cs:28
Castle.Core.Logging.AbstractLoggerFactory.Create(Type type) +31
Orchard.Logging.CastleLoggerFactory.CreateLogger(Type type) in CastleLoggerFactory.cs:12
Orchard.Logging.LoggingModule.CreateLogger(IComponentContext context, IEnumerable1 parameters) in LoggingModule.cs:75
Autofac.Builder.<>c__DisplayClass1
1.<ForDelegate>b__0(IComponentContext c, IEnumerable1 p) +17
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable
1 parameters) +30
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) +48
Autofac.Core.Resolving.InstanceLookup.Execute() +48
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
1 parameters) +167
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) +23
Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable
1 parameters, Object& instance) +72
Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) +54
Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable
1 parameters) +121
Orchard.Logging.<>c__DisplayClass11.<BuildLoggerInjectors>b__8(String key) in LoggingModule.cs:65
System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) +72
Orchard.Logging.<>c__DisplayClassf.<BuildLoggerInjectors>b__7(IComponentContext ctx, Object instance) in LoggingModule.cs:65
Orchard.Logging.<>c__DisplayClass1.<AttachToComponentRegistration>b__0(Object s, ActivatedEventArgs1 e) in LoggingModule.cs:40
Autofac.Core.Registration.ComponentRegistration.RaiseActivated(IComponentContext context, IEnumerable
1 parameters, Object instance) +70
Autofac.Core.Resolving.InstanceLookup.Complete() +85
Autofac.Core.Resolving.ResolveOperation.CompleteActivations() +114
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) +207
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable
1 parameters) +50

[DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details.]
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) +119
Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable
1 parameters) +159
Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) +17
Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable
1 parameters, Object& instance) +72
Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) +54
Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable
1 parameters) +121
Orchard.Environment.OrchardStarter.CreateHostContainer(Action1 registrations) in OrchardStarter.cs:132
Orchard.Web.MvcApplication.HostInitialization(HttpApplication application) in Global.asax.cs:46
Orchard.WarmupStarter.<>c__DisplayClass3.<LaunchStartupThread>b__2(Object state) in Starter.cs:89

[ApplicationException: Error during application initialization]
Orchard.WarmupStarter.Starter
1.OnBeginRequest(HttpApplication application) in Starter.cs:63
Orchard.Web.MvcApplication.Application_BeginRequest() in Global.asax.cs:29

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +57
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Apr 15, 2013 at 4:01 PM
I just had a mail from my provider and he told me that Log4net is not installed in the GAC. This should be done by a bin deploy from VS/Webmatrix. I have no clue at all what this means and whether we can solve it.

Does this mean that it's not possible to run my site? or how can i solve this?
Which provider in the Netherlands i should go to to let my site run?
Many questions, hope to get answers :-)
Developer
Apr 15, 2013 at 4:13 PM
You don't need Log4Net in the GAC; it's deployed as part of Orchard, and from the looks of it, it's there.
Perhaps it's a Medium Trust issue? Could you verify with your hosting provider that your site is running in Full Trust?
Apr 15, 2013 at 4:22 PM
The provider told me that they are running "customized medium trust".
Is it possibnle to see from the stack trace what is happening.
Does it has to do with login in processes?
thanks for your answer
Developer
Apr 15, 2013 at 4:41 PM
It's right there on the first line:
Inheritance security rules violated while overriding member: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo,
System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overridden
Sounds like the customized medium trust isn't trustful enough. Read more about it here: https://issues.apache.org/jira/browse/LOG4NET-347

Orchard requires Full Trust, so you may want to ask your hosting provider what the options are.
Apr 15, 2013 at 4:50 PM
Provider only supports customized medium trust, so do you know a provider who is supporting full trust in the Netherlands
Developer
Apr 15, 2013 at 4:56 PM
I don't, sorry. I'm hosting with Windows Azure. Before that, I leased my own servers with LeaseWeb (a Dutch company) to which I had full access.
Apr 15, 2013 at 5:11 PM
Short question is now:
Will it not be possible anymore to run Orchard without going into Azure. If that is so, i need to learn much more again. What are the next changes in the future :-)
thanks again for your answers
Developer
Apr 15, 2013 at 5:22 PM
Edited Apr 15, 2013 at 5:22 PM
It is perfectly possible to run Orchard without Azure. If there's a hosting provider that offers full trust and ASP.NET 4.5 then you're fine. Many hosting providers I found are still running behind, contrary to Azure, which is always up to date with latest and greatest, and offers a great deal of flexibility and control. And honestly, Windows Azure could not have been easier when you host your site with Windows Azure Websites.
One can only guess about the future, but you can bet that things will always change. Embrace it. :)