What version of NHibernate are you using?

NH 3.2 does not support Medium Trust out of the box, there is a fix pending
on GitHub so please feel free to vote the issue up if you wish
https://nhibernate.jira.com/browse/NH-2857 

There is also a temp fix on Nuget
http://nuget.org/List/Packages/NHibernate.DependencyInjection 

BTW / refers to your root page on your website :)

Rippo


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Khaled
Sent: 05 September 2011 19:19
To: nhusers
Subject: [nhusers] security exception in SessionFactory.OpenSession()

I can create the SessionFactory, which creates a table in my database
with the proper column. But as soon as I do OpenSession(), i get the
following error. Looks like it is trying to read something from "/"
path.

Here are my mapping:
 public MyClassMapper()
        {
            Lazy(false);
            Id(x => x.Id, map => map.Generator(Generators.GuidComb));
            Table("myclasses");
            Property(x => x.Name, x => x.NotNullable(true));
        }

I have also done:
      NHibernate.Cfg.Environment.UseReflectionOptimizer = false;

This website is hosted in a shared hosting server (medium trust).

Server Error in '/' Application.

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: 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.]
 
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly
asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle
rmh, SecurityAction action, Object demand, IPermission permThatFailed)
+150
 
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object
assemblyOrString, PermissionSet granted, PermissionSet refused,
RuntimeMethodHandle rmh, SecurityAction action, Object demand,
IPermission permThatFailed) +100
 
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet
grants, PermissionSet refused, PermissionSet demands,
RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction
action, Boolean throwException) +283
   System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet
demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh)
+69
   System.Security.PermissionListSet.CheckSetDemand(PermissionSet
pset, RuntimeMethodHandle rmh) +150
   System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32
flags, PermissionSet grantSet) +30
   System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags,
PermissionSet grantSet) +40
 
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32
permission, PermissionSet targetGrant, CompressedStack
securityContext) +123
 
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32
permission, PermissionSet targetGrant) +54

Version Information: Microsoft .NET Framework Version:2.0.50727.5446;
ASP.NET Version:2.0.50727.5420

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

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

Reply via email to