Also this suggests this is possible in earlier versions. I'm not sure
how to force NUnit to run in Medium Trust though. Maybe we could
create a plugin for this?

TODO: Investigate the plugin option

http://blogs.msdn.com/shawnfa/archive/2004/11/02/251239.aspx

On 6 Paź, 13:14, Jonathon Rossi <[email protected]> wrote:
> This does seem possible in at least .NET 
> 4.0:http://blogs.rev-net.com/ddewinter/2009/05/22/how-to-host-a-partial-t...http://blogs.msdn.com/clrteam/archive/2009/06/10/new-security-model-m...
>
> 2009/10/6 Krzysztof Koźmic (2) <[email protected]>
>
>
>
>
>
> > I'm not sure. I did a research on this some time ago, and found no
> > good solution.
>
> > On 6 Paź, 11:33, John Simons <[email protected]> wrote:
> > > Is there any test we can write to ensure Medium trust works and we
> > > don't break it by mistake?
>
> > > On Oct 6, 8:28 pm, Krzysztof Koźmic (2) <[email protected]> wrote:
>
> > > > Cool John,
>
> > > > Keep us posted if you find the cause of this misbehavior.
>
> > > > Krzysztof
>
> > > > On 6 Paź, 11:13, John Polling <[email protected]> wrote:
>
> > > > > I think for me the issue lies with NHibernate now.  I'll post
> > > > > something on the NHib group.
>
> > > > > Thanks
>
> > > > > John
>
> > > > > On Oct 5, 8:22 pm, Krzysztof Koźmic <[email protected]>
> > > > > wrote:
>
> > > > > > John,
>
> > > > > > Were you able to detect which assembly is the cause of the
> > exception?
>
> > > > > > Krzysztof
>
> > > > > > John Polling wrote:
> > > > > > > Hi Roelof,
>
> > > > > > > Unfortunately I've already done all that :-(.
>
> > > > > > > I'm starting to think I need to move to a new hosting company who
> > > > > > > don't switch to medium trust suddenly.
>
> > > > > > > John
>
> > > > > > > On Oct 5, 6:21 am, Roelof Blom <[email protected]> wrote:
>
> > > > > > >> Make sure you have marked all *referenced* assemblies with the
> > > > > > >> AllowPartiallyTrustedCallersAttribute assembly level attribute,
> > don't forget
> > > > > > >> your assembly with AR models.
>
> > > > > > >> Build Castle with the following command: 'build.cmd
> > > > > > >> -D:assembly.allow-partially-trusted-callers=true'.
>
> > > > > > >> -- Roelof.
>
> > > > > > >> 2009/10/5 John Polling <[email protected]>
>
> > > > > > >>> I appear to still be having problems with Medium Trust.
> > > > > > >>> I've set the ActiveRecord settings as described here
> > > > > > >>>http://nhforge.org/wikis/howtonh/run-in-medium-trust.aspx
>
> > > > > > >>> Has anyone got any further than this?
>
> > > > > > >>> Here is the error I'm getting:
>
> > > > > > >>>  Security Exception
> > > > > > >>> Description: The application attempted to perform an operation
> > not
> > > > > > >>> allowed by the security policy.  To grant this application the
> > > > > > >>> required permission please contact your system administrator or
> > change
> > > > > > >>> the application's trust level in the configuration file.
>
> > > > > > >>> Exception Details: System.Security.SecurityException: That
> > assembly
> > > > > > >>> does not allow partially trusted callers.
>
> > > > > > >>> 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:
>
> > > > > > >>> [SecurityException: That assembly does not allow partially
> > trusted
> > > > > > >>> callers.]
>
> > System.Security.CodeAccessSecurityEngine.ThrowSecurityException
> > > > > > >>> (Assembly asm, PermissionSet granted, PermissionSet refused,
> > > > > > >>> RuntimeMethodHandle rmh, SecurityAction action, Object demand,
> > > > > > >>> IPermission permThatFailed) +150
> > > > > > >>>   System.RuntimeTypeHandle.CreateInstance(RuntimeType type,
> > Boolean
> > > > > > >>> publicOnly, Boolean noCheck, Boolean& canBeCached,
> > > > > > >>> RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
> > > > > > >>>   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly,
> > Boolean
> > > > > > >>> fillCache) +86
> > > > > > >>>   System.RuntimeType.CreateInstanceImpl(Boolean publicOnly,
> > Boolean
> > > > > > >>> skipVisibilityChecks, Boolean fillCache) +230
> > > > > > >>>   System.Activator.CreateInstance(Type type, Boolean nonPublic)
> > +67
>
> > NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type
> > > > > > >>> type) +8
> > > > > > >>>   NHibernate.Driver.ReflectionBasedDriver.CreateConnection()
> > +28
>
> > NHibernate.Connection.DriverConnectionProvider.GetConnection() +56
>
> > NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare
> > > > > > >>> () +15
>
> > NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords
> > > > > > >>> (Dialect dialect, IConnectionHelper connectionHelper) +65
> > > > > > >>>   NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update
> > > > > > >>> (ISessionFactory sessionFactory) +80
> > > > > > >>>   NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg,
> > > > > > >>> IMapping mapping, Settings settings, EventListeners listeners)
> > +599
> > > > > > >>>   NHibernate.Cfg.Configuration.BuildSessionFactory() +87
>
> > Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory
> > > > > > >>> (Type type) +465
>
> > Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession
> > > > > > >>> (Type type) +126
> > > > > > >>>   Castle.ActiveRecord.ActiveRecordBase.FindAll(Type targetType,
> > Order
> > > > > > >>> [] orders, ICriterion[] criteria) +117
> > > > > > >>>   Castle.ActiveRecord.ActiveRecordBase`1.FindAll(Order order,
> > > > > > >>> ICriterion[] criteria) +129
> > > > > > >>>   Syncmaster.Models.NewsItem.FindTop(Int32 i) +112
> > > > > > >>>   Syncmaster.Controllers.HomeController.Index() +55
>
> > > > > > >>> On Oct 2, 2:19 pm, John Polling <[email protected]>
> > wrote:
>
> > > > > > >>>> I did a quick a dirty check by removing the offending code and
> > all is
> > > > > > >>>> pretty much working, except I need to run through and set all
> > the
> > > > > > >>>> entity models to virtual :-)  I'd forgotten how different the
> > RC was
> > > > > > >>>> to the trunk!
>
> > > > > > >>>> Thanks
>
> > > > > > >>>> John
>
> > > > > > >>>> On Oct 2, 1:47 pm, Krzysztof Koźmic <
> > [email protected]>
> > > > > > >>>> wrote:
>
> > > > > > >>>>> From the quick look I had:
> > > > > > >>>>> The class initializes FileSystemWatcher, which accorting
> > tohttp://
>
> > msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
>
> > > > > > >>>>> requires fulltrust.
> > > > > > >>>>> I'm not familiar with the class, but I think we should do
> > similar
> > > > > > >>>>> things I do in DynamicProxy - verify that we have the
> > required
> > > > > > >>>>> permission, and disable this functionality if we don't. Is
> > this
> > > > > > >>>>> feasible?
>
> > > > > > >>>>> 2009/10/2 John <[email protected]>:
>
> > > > > > >>>>>> Hi,
>
> > > > > > >>>>>> My hosting company has usefully switched their servers
> > tomedium
> > > > > > >>>>>> trust.  This has broken a site I've had running for a couple
> > of years
> > > > > > >>>>>> now.
>
> > > > > > >>>>>> Here is what's happened so far.
> > > > > > >>>>>> 1. Upgrade to trunk and compiled with themediumtrustflag.
> > > > > > >>>>>> 2. Krzysztof Koźmic fixed an issue with Dynamic Proxy
> > > > > > >>>>>> 3. Upgraded the trunk to run off Boo 2.0.9.2.
>
> > > > > > >>>>>> However I'm still getting the following error, any
> > suggestions would
> > > > > > >>>>>> be greatly appreciated.
>
> > > > > > >>>>>>  Security Exception
> > > > > > >>>>>> Description: The application attempted to perform an
> > operation not
> > > > > > >>>>>> allowed by the security policy.  To grant this application
> > the
> > > > > > >>>>>> required permission please contact your system administrator
> > or
>
> > > > > > >>> change
>
> > > > > > >>>>>> the application'strustlevel in the configuration file.
>
> > > > > > >>>>>> Exception Details: System.Security.SecurityException:
> > Request failed.
>
> > > > > > >>>>>> 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:
>
> > > > > > >>>>>> [SecurityException: Request failed.]
>
> > Castle.MonoRail.Framework.FileAssemblyViewSourceLoader.GetViewFolderWatcher
>
> > > > > > >>>>>> (String path) +0
>
> > Castle.MonoRail.Framework.FileAssemblyViewSourceLoader.InitViewFolderWatch
>
> > > > > > >>>>>> () +145
>
> > Castle.MonoRail.Framework.FileAssemblyViewSourceLoader.add_ViewChanged
>
> > > > > > >>>>>> (FileSystemEventHandler value) +126
> > > > > > >>>>>>   Castle.MonoRail.Views.Brail.BooViewEngine.Initialize()
> > +474
>
> > Castle.MonoRail.Framework.Services.DefaultViewEngineManager.Initialize
>
> > > > > > >>>>>> () +634
>
> > Castle.MonoRail.Framework.Services.DefaultServiceInitializer.Initialize
>
> > > > > > >>>>>> (Object serviceInstance, IMonoRailServices container) +193
>
> > Castle.MonoRail.Framework.Container.DefaultMonoRailContainer.CreateService
>
> > > > > > >>>>>> (Type type) +279
>
> > > > > > >>>>>> Thanks
>
> > > > > > >>>>>> John
>
> --
> Jono
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
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