I'm seeing this same issue on a project built with Sharp Architecture which uses Castle and NHibernate. It looks like I'm chasing through the same hoops you are. I found this thread to have some direction, but I'm not sure how to actually apply this info. http://social.msdn.microsoft.com/Forums/en-US/netfxgeneralprerelease/thread/825ccf02-a505-40ee-ac95-44a4918c6ee5
The error seems to indicate that some virtual method override is causing a security level change from the original implementation of the method. I had read a post that indicated this might be due to the castle proxy implementation or have something to do with needing to enable lazy loading on all entity classes. I'm still not sure if either of those solutions are correct, or how to implement them, but I'll post if I find something. On Wednesday, October 17, 2012 4:32:29 AM UTC-5, aozora wrote: > > I've deployed a asp.net mvc 3 project wich use castle.core & windsor, but > running on my hosting (in shared hosting) I got this: > Inheritance security rules violated while overriding member: > 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. 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: > 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. 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: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. > Security accessibility of the overriding method must match the security > accessibility of the method being overriden.] > Castle.Windsor.WindsorContainer..ctor() +0 > MyProj.Framework.Web.Core.App_Start.Bootstrapper.InitializeIoC() in > PreApplicationStart.cs:98 > MyProj.Framework.Web.Core.App_Start.Bootstrapper.PreApplicationStart() > in PreApplicationStart.cs:70 > > [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 > WebActivator.BaseActivationMethodAttribute.InvokeMethod() +78 > WebActivator.ActivationManager.RunActivationMethods() +348 > WebActivator.ActivationManager.Run() +22 > > [InvalidOperationException: The pre-application start initialization > method Run on type WebActivator.ActivationManager threw an exception with > the following error message: Exception has been thrown by the target of an > invocation..] > > System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 > methods) +423 > System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306 > System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager > appManager, IApplicationHost appHost, IConfigMapPathFactory > configMapPathFactory, HostingEnvironmentParameters hostingParameters, > PolicyLevel policyLevel, Exception appDomainCreationException) +677 > > [HttpException (0x80004005): The pre-application start initialization > method Run on type WebActivator.ActivationManager threw an exception with > the following error message: Exception has been thrown by the target of an > invocation..] > System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090876 > System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97 > > System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest > wr, HttpContext context) +256 > > On the Castle bugtracker I found this: > http://issues.castleproject.org/issue/IOC-233?projectKey=IOC&query=InitializeLifetimeService > but is 2 year old and seems to be resolved... > > Please help, any ideas? > > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/castle-project-users/-/LF6-7-oQpywJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
