views:

117

answers:

1

I'm developing a web application with VS2008 and NHibernate and I cannot access my database (MSSQL Server 2005). Here is my stack trace

[SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Security.CodeAccessSecurityEngine.Check(Object demand, 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 NHibernate.Connection.DriverConnectionProvider.GetConnection() +224 NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare() +30 NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dialect, IConnectionHelper connectionHelper) +78 NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessionFactory) +149 NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) +803 NHibernate.Cfg.Configuration.BuildSessionFactory() +129 DALC.Contest.save() +128

A: 

Without a bit more information this sounds like a AppDomain Security issue. Here are a few links. The first is probably the one that will help you the most:

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data

How to provide extra trust for an Internet Explorer hosted assembly

.NET Framework Enterprise Security Policy Administration and Deployment

Tim C