Build prevents partially trusted subscribers
I am creating a site using free NHibernate which works great in dev box. However, after I have downloaded it to my host, I get the following when I try to run it.
"System.TypeInitializationException: Type initializer for" NHibernate.ByteCode.Castle.ProxyFactory "threw an exception. ---> System.Security.SecurityException: This assembly does not allow partially trusted callers.
Is this something I need to solve with the hosting company (CrystalTech)? Any help is greatly appreciated.
Rest of inner exception:
at Castle.DynamicProxy.ModuleScope..ctor (Boolean savePhysicalAssembly, String strongAssemblyName, String strongModulePath, String weakAssemblyName, String weakModulePath) at Castle.DynamicProxy.ModuleScope..ctor (Boolean savePhysicalAssembly) at Castle.DynamicProxy.Proxy NHibernate.ByteCode.Castle.ProxyFactory..cctor () Action Failed: LinkDemand Build Failure Zone: MyComputer
--- End of the internal exception stack trace ---
source to share
nHibernate does not work out of the box in a medium trust environment (which most shared hosts run your application). Lazy Loading with nHibernate Under Medium Trust describes some of the steps taken to get it to work.
source to share
The problem isn't NHibermate, it's Castle. Check this post:
http://blogs.taiga.nl/martijn/2009/06/24/new-adventures-under-medium-trust/
source to share