In one of my latest projects I've managed to run NHibernate in medium trust environment. I've pre-generated lazy loading proxies.
See my blog post for refenerce: http://it.tmod.pl/Blog/EntryId/145/NHibernate-Transparent-pre-generation-of-lazy-loading-proxies-in-Visual-Studio.aspx I need to do: - pre-generate proxies (as in blog post) - set in NHibenrate configuration property "proxyfactory.factory_class" with correct value : "CastleStaticProxyFactoryFactory, AssemblyNameWithoutDotDll" - set in code NHibernate.Cfg.Environment.UseReflectionOptimizer = false; (UseReflectionOptimizer is not configuration file property). As I remember that's all. regards, Tomasz Modelski http://it.tmod.pl On Oct 6, 2:45 pm, John Polling <[email protected]> wrote: > Hi Morten, > > Thanks, but I've already done the -D:assembly.allow-partially-trusted- > callers=true. > > John > > On Oct 6, 1:12 pm, "Morten Maxild" <[email protected]> wrote: > > > Use Reflector to see if Castle was build with APTCA attribute. Don't know > > about the official distro about APCTA. > > > Otherwise if you build from source use this with nant: > > '-D:assembly.allow-partially-trusted-callers=true' > > > All signed assemblies needs APTCA attribute to work in medium trust. > > > HTH > > Morten > > > >-----Original Message----- > > >From: [email protected] [mailto:[email protected]] On Behalf > > >Of John > > >Sent: Tuesday, October 06, 2009 11:39 AM > > >To: nhusers > > >Subject: [nhusers] Having medium trust issues > > > >Hi, > > > >My existing hosting company has suddenly switched to a medium trust > > >setup. I'm using the latest build from Castle and I've gone through a > > >number of issues with that. (http://groups.google.com/group/castle- > > >project-users/browse_thread/thread/98937c21efa854de) > > > >I've managed to progress things, with the help of the Castle team > > >however I'm now getting the following error and was wondering if > > >anyone here has managed to get the NHibernate side of things working > > >on medium trust. > > > >I've set the ActiveRecord / NHibernate 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 > > > >Thanks in advance > > > >John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
