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
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
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