Замок Виндзор не работает под Medium Trust

При попытке запустить приложение ASP.NET MVC, которое использует Castle Windsor, возникает следующая ошибка.

Server Error in '/' Application.

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

СборкиCastle.Core.dll а такжеCastle.Windsor.dll был построен на основе исходного кода, доступного наGitHub, Исходный код для сборок включает в себя файлSecurityAssemblyInfo.cs который имеет следующий исходный код:

// Sets up assembly level security settings
#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" />.

Ответы на вопрос(1)

Ваш ответ на вопрос