我正在使用VS2008和NHibernate开发一个Web应用程序,但我无法访问我的数据库(MSSQL Server 2005)。 这是我的堆栈跟踪
[SecurityException:请求类型'System.Data.SqlClient.SqlClientPermission,System.Data, Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089' 失败。] System.Security.CodeAccessSecurityEngine.Check(对象 需求,StackCrawlMark& stackMark,Boolean isPermSet)+0
System.Security.PermissionSet.Demand()+76
System.Data.Common.DbConnectionOptions.DemandPermission()+79
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(的DbConnection outerConnection,DbConnectionFactory connectionFactory)+6265031
System.Data.SqlClient.SqlConnection.Open()+ 258 8 NHibernate.Connection.DriverConnectionProvider.GetConnection()+224
NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare() +30 NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(方言) 方言,IConnectionHelper connectionHelper)+78
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessionFactory)+149
NHibernate.Impl.SessionFactoryImpl..ctor(配置cfg,IMapping 映射,设置设置,EventListeners侦听器)+803
NHibernate.Cfg.Configuration.BuildSessionFactory()+ 129 DALC.Contest.save()+ 128
答案 0 :(得分:0)
如果没有更多信息,这听起来像AppDomain安全问题。这里有一些链接。第一个可能是最能帮助你的那个:
How to provide extra trust for an Internet Explorer hosted assembly
.NET Framework Enterprise Security Policy Administration and Deployment