尽管修复了NHibernate在Medium Trust(https://nhibernate.jira.com/browse/NH-2857)上的工作,但我无法在我的环境中运行它。这似乎不是一个开箱即用的功能,它根本没有记录。
我的NH Config部分是:
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">MY_CON_STRING</property>
<mapping assembly="MyAssembly" />
</session-factory>
</hibernate-configuration>
我用
运行我的应用程序<trust level="Medium"/>
我得到以下例外:
[SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +31
System.Security.CodeAccessPermission.Demand() +46
System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca) +84
知道如何在Medium trust中运行NHibernate 3.3.2吗?