I've deployed to a server a web application that uses NHibernate. The application compiles and runs fine on my local dev machine, but there's an issue with NHibernate on the new server. I get the following error:
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 for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=tokenkeyhere' failed.
It suggests to change the application's "trust level" in the configuration file. How exactly do I do that? This is the first time I've deployed a NHibernate web app, so I'm at a loss.
We've been looking at this a lot lately. Here is a link on running NHibernate in medium trust
This is the most succinct explanation I've seen of the different trust levels: Trust Levels Demystified
From the article:
- Full trust – your code can do anything that the account running it can do.
- High trust – same as above except your code cannot call into unmanaged code. i.e. Win32 APIs, COM interop.
- Medium trust – same as above except your code cannot see any part of the file system except its application directory.
- Low trust – same as above except your code cannot make any out-of-process calls. i.e. calls to a database, network, etc.
- Minimal trust – code is restricted from anything but the most trival processing (calculating algorithms).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With