"安全"在部署Web应用程序的问题与NHibernate [英] "Security" problem with NHibernate on deployed web application
问题描述
我已经部署到服务器使用的NHibernate的Web应用程序。该应用程序编译和运行我的本地开发机器上的罚款,但有新的服务器上是一个问题与NHibernate。我收到以下错误:
说明:尝试的应用
执行不允许通过操作
安全策略。要授予此
应用程序所需的权限
请联系您的系统
管理员或改变
在应用程序的信任级别
配置文件。
异常详细信息:
System.Security.SecurityException:
申请类型的权限
System.Configuration.ConfigurationPermission,
System.Configuration,版本= 4.0.0.0,
文化=中立,
公钥= tokenkeyhere
失败了。
块引用>它建议更改配置文件中的应用程序的信任度。究竟是如何做呢?这是我第一次部署了NHibernate的Web应用程序,所以我无所适从。
解决方案我们一直在寻找这个很多最近。这里是href=\"http://nhforge.org/wikis/howtonh/run-in-medium-trust.aspx\" rel=\"nofollow\">在中等信任
这是我见过的不同信任级别的最简洁的解释:的信任级别揭秘
从文章:
- 完全信任 - 你的code可以做任何事情,运行它可以做的帐户。
- 高度信任 - 与上面相同,除了你的code不能调用非托管code。即的Win32 API,COM互操作。
- 中等信任 - 与上面相同,除了你的code不能看到除了它的应用程序目录的文件系统的任何部分。
- 低信任 - 与上面相同,除了你的code不能做任何超出过程调用。即,调用一个数据库,网络等
- 最小信任 - code是从什么,但最繁琐的处理(计算算法)的限制。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).
这篇关于"安全"在部署Web应用程序的问题与NHibernate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!