When you try to start an ASP.NET MVC application that uses Castle Windsor, the following error occurs.
Server error in application "/".
Inheritance security rules that are violated when overriding an element: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService ()'. The security of access to the primary method must match the security of access to the method, which is being re-evaluated.
Description: An unhandled exception occurred during the execution of the current web request. View the stack trace for error information and where it originated in the code.
Exception Details: System.TypeLoadException: Inheritance Protection Rules Violated by Member Overrides: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService ()'. The security of access to the primary method must match the security of access to the method, which is being re-evaluated.
Source Error:
An unhandled exception was thrown during the execution of the current web request. Information about the origin and location of the exception can be identified using the exception stack trace below.
Stack trace:
[TypeLoadException: : 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. .]
Castle.Windsor.WindsorContainer..ctor() +0
Castle.Core.dll Castle.Windsor.dll , github. SecurityAssemblyInfo.cs, :
#if ! SILVERLIGHT
[assembly: System.Security.AllowPartiallyTrustedCallers]
#if DOTNET40
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level2)]
#endif
#endif
ILSpy, System.Security.AllowPartiallyTrustedCallers .
- <trust level="Medium" />.