这是错误:
System.TypeInitializationException: The type initializer for 'NHibernate.Cfg.Environment' threw an exception.
---> System.Security.SecurityException: Request for ConfigurationPermission failed while attempting to access configuration section 'hibernate-configuration'. To allow all callers to access the data for this section, set section attribute 'requirePermission' equal 'false' in the configuration file where this section is declared.
---> System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca)
我们将信任级别设置为Full。另请注意,我们还有一个运行SAME Nhibernate代码的网站,没有任何问题。只有WCF REst Web服务应用程序出现此错误?
为什么这是一个问题的任何想法?
答案 0 :(得分:0)
将应用程序池的标识从“ApplicationPoolIdentity”更改为“NetworkService”,并在文件系统文件夹中为“NetworkService”帐户提供“修改”权限。