我已经在服务器上部署了一个使用NHibernate的Web应用程序。该应用程序在我的本地开发机器上编译并运行良好,但在新服务器上存在NHibernate的问题。我收到以下错误:
描述:尝试了应用程序 执行不允许的操作 安全政策。授予这个 申请所需的许可 请联系您的系统 管理员或更改 应用程序的信任级别 配置文件。
异常详细信息: System.Security.SecurityException: 请求类型的许可 “System.Configuration.ConfigurationPermission, System.Configuration,Version = 4.0.0.0, 文化=中性, 公钥= tokenkeyhere” 失败。
它建议在配置文件中更改应用程序的“信任级别”。我到底该怎么做?这是我第一次部署NHibernate Web应用程序,所以我很茫然。
答案 0 :(得分:3)
我们最近一直在关注这个问题。以下是running NHibernate in medium trust
上的链接这是我见过的关于不同信任级别的最简洁的解释:Trust Levels Demystified
来自文章:
- 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).