Castle Windsor / Core 2.5.3 in medium trust

100 views
Skip to first unread message

Phil Whittaker

unread,
Mar 9, 2012, 5:14:09 AM3/9/12
to castle-pro...@googlegroups.com
I am trying to run Castle in medium trust as a sandbox. I have added the APTC tag and the [assembly: SecurityRules(System.Security.
SecurityRuleSet.Level1)].

I am still getting a security error when constrcuting dynamic proxy

[SecurityException: Request failed.] Castle.Core.Internal.PermissionUtil.IsGranted(IPermission permission) +0
Castle.DynamicProxy.ProxyGenerator..ctor(IProxyBuilder builder) +90 Castle.Windsor.Proxy.DefaultProxyFactory.Init() +114
Castle.Windsor.WindsorContainer..ctor(String name, IKernel kernel, IComponentsInstaller

What can I do to fix this?

hammett

unread,
Mar 9, 2012, 7:52:09 PM3/9/12
to castle-pro...@googlegroups.com
Are you setting up your own appdomain or are you just using asp.net in
medium trust?

> --
> 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/-/RsVopcrZyp8J.
> To post to this group, send email to castle-pro...@googlegroups.com.
> To unsubscribe from this group, send email to
> castle-project-u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.

--
Cheers,
hammett
http://hammett.castleproject.org/

Josh.Go

unread,
Mar 10, 2012, 3:13:49 PM3/10/12
to Castle Project Users
Hi Hammet,

I'm also having a Medium Trust issue. And just as FYI, I'm using
FluentNHibernate v1.2 (for NH3.1).

I'm setting it up via web.config:


<location allowOverride="true">
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal" />
<trustLevel name="High"
policyFile="web_hightrust.config" />
<trustLevel name="Medium"
policyFile="web_mediumtrust.config" />
....
</securityPolicy>
<trust level="Medium" originUrl="" />
</system.web>
</location>

I can provide you a copy of my mediumtrust config file. It was
provided to me by my hosting provider.


Thanks,
Josh

Josh.Go

unread,
Mar 10, 2012, 4:45:47 PM3/10/12
to Castle Project Users
I got somewhere.

I downloaded all the source code, and grabbed the latest releases.

FluentNHibernate (1.2)
Castle.Core (3.0)
NHibernate (3.2)

Issue #1
Fluent is built for NH3.1. It comes with it's own copy of
"NHibernate.ByteCode.Castle.dll" but causes medium trust errors.

Issue #2
After hearing some positive feadback, I tried running Fluent with
NH3.2. However, the "NHibernate.ByteCode.Castle.dll" that came with
Fluent was built for NH2.1. Also "NHibernate.ByteCode.Castle" was
built against Castle.Core v 1.1. The medium trust fix that Krysztof
applied from Martijn Boland was applied after 1.1. Swapping the
Castle.Core.dll doesn't work

Anyway, I was able to get something working. I did so by grabbing the
latest version of NHibernate.ByteCode.Castle's source from NH's git
repository. I compiled it against the latest Castle.Core. I had to do
a minor update to NHibernate.ByteCode.Castle since there was a minor
interface update with NH3.2's AbstractProxyFactory.

It seems to be working now, but it's a bit of a hack. I think the
important thing is to use the latest Castle.Core binary for lazy
loading. I tried Linfu, and I was met with all sorts of errors.


Thanks,
Josh
Reply all
Reply to author
Forward
0 new messages