4
votes

My MVC Project had been running properly in localhost when I had published it on web, I had this error,

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 Blog.Core.Bootstrapper.Start(Assembly[] assemblies) +130 Blog.MvcApplication.Application_Start() +970

I have read this answer.

I recompiled Castle Project with those instructions. I have deleted Castle.Core.dll safely in my project and added recompiled the Castle.Core.dll. But I still have the same error.

What can I do? How can I solve this problem that I have been struggling with over the past 2 weeks?

2
sounds like an IIS / reflection issue to me. You need to be running in full trustuser3210546
@user3210546 Yes, I need but my hosting service doesn't permit, I should find a solution.Kerem Zaman

2 Answers

0
votes

User needs to find a hosting provider that supports Full Trust. Most providers who are ASP.Net friendly support Full Trust as there is no real reason these days not to.

This is most likely the answer to your question sir.

0
votes

This could work

<system.web>
  <trust level="Full" />
</system.web>

Try that on the web.config, cheers