NHibernate WCF休息IIS7失败,出现安全漏洞

时间:2010-03-23 20:11:44

标签: wcf nhibernate rest iis-7

这是错误:

    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服务应用程序出现此错误?

为什么这是一个问题的任何想法?

1 个答案:

答案 0 :(得分:0)

http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/107/threadid/344545/scope/posts/Default.aspx

将应用程序池的标识从“ApplicationPoolIdentity”更改为“NetworkService”,并在文件系统文件夹中为“NetworkService”帐户提供“修改”权限。