I'm having enormous difficulty getting Castle.Windsor to run under a medium 
trust setting. I'm referencing Windsor from an ASP.NET MVC 4 application 
with <trust level="Medium" /> in the root web.config.

After about thirty hours invested in this so far, I've determined a few 
things:

* Castle.Core & Castle.Windsor assemblies are compiled with 
AllowPartiallyTrustedCallersAttribute (APTCA) and 
SecurityRules(SecurityRuleSet.Level2) under a DOTNET40 build.
* APTCA is causing these libraries to be evaluated as TransparentSecurity, 
or Partial Trust.
* Sections of the assemblies are elevated using SecurityCriticalAttribute. 
This is typically the case in classes which inherit MarshalByRefObject in 
the InitializeLifetimeService method overloads.
* SecurityCriticalAttribute will only elevate successfully under a full 
trust AppDomain and as such, my MVC app is failing.

The outcome is a TypeLoadException: Inheritance security rules violated 
while overriding member. Security accessibility of the overriding method 
must match the security accessibility of the method being overriden.

So, MarshalByRefObject.InitializeLifetimeService is a SecurityCritical 
method and it cannot be elevated from SecurityTransparent due to my trust 
level. Sounds like I'm KO'd. I'm hoping someone more knowledgeable in trust 
levels can educate me on a solution here.

As an aside, I tried removing the inheritance on MarshalByRefObject from 
all classes in Core and Windsor and deleting the InitializeLifetimeService. 
I was hoping that would be okay, since I don't need remoting (though I'm 
not perfectly clear on the consequences of this since I'm not educated on 
remoting much at all) but at some point during the factoring I lost the 
ability to compile Windsor.

-- 
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/-/hKZ0nfudKaAJ.
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.

Reply via email to