Upgrading from V1.4 to V1.5, Security Exception

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 years ago
V1.4 ran perfectly fine.  V1.5 is throwing an exception.  This is in my dev machine and the site has full trust:

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:


Line 998:            DbCommand dbCommand = db.GetStoredProcCommand("Nop_CustomerSessionLoadByPrimaryKey");
Line 999:            db.AddInParameter(dbCommand, "CustomerSessionGUID", DbType.Guid, CustomerSessionGUID);
Line 1000:            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
Line 1001:            {
Line 1002:                if (dataReader.Read())


Source File: D:\Websites\IL\Libraries\Nop.DataAccess.SqlServer\Customer\SQLCustomerProvider.cs    Line: 1000

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
   Microsoft.Practices.EnterpriseLibrary.Data.Database.GetNewOpenConnection() +370
   Microsoft.Practices.EnterpriseLibrary.Data.Database.GetOpenConnection(Boolean disposeInnerConnection) +176
   Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command) +83
   NopSolutions.NopCommerce.DataAccess.CustomerManagement.SQLCustomerProvider.GetCustomerSessionByGUID(Guid CustomerSessionGUID) in D:\Websites\IL\Libraries\Nop.DataAccess.SqlServer\Customer\SQLCustomerProvider.cs:1000
   NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.CustomerManager.GetCustomerSessionByGUID(Guid CustomerSessionGUID) in D:\Websites\IL\Libraries\Nop.BusinessLogic\Customer\CustomerManager.cs:1880
   NopSolutions.NopCommerce.BusinessLogic.NopContext.GetSession(Boolean createInDatabase, Nullable`1 sessionId) in D:\Websites\IL\Libraries\Nop.BusinessLogic\NopContext.cs:117
   NopSolutions.NopCommerce.BusinessLogic.NopContext.GetSession(Boolean createInDatabase) in D:\Websites\IL\Libraries\Nop.BusinessLogic\NopContext.cs:88
   NopSolutions.NopCommerce.BusinessLogic.NopContext.get_Session() in D:\Websites\IL\Libraries\Nop.BusinessLogic\NopContext.cs:247
   NopSolutions.NopCommerce.HttpModules.MembershipHttpModule.Application_BeginRequest(Object sender, EventArgs e) in D:\Websites\IL\Libraries\Nop.HttpModules.MembershipModule\MembershipHttpModule.cs:146
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
14 years ago
Create a new application pool for nopCommerce then assign the site to the application pool using IIS.

If that doesn't work then the next task is editing of machine.config, hope we don't need to go there since it's highly unusual to have to modify it.
14 years ago
I had an app pool for it, even tried creating a new one and assigning it.  Still has the error.

It just seems strange that this is happening.  I have at least 8 sites on my dev machine (this is the only nopCommerce site), and all of those work perfectly fine.

Google searching the error seems to find a bunch of unreleated junk from years ago.

Ugh!
14 years ago
One other quick note:  The site works if I run it from Visual Studio.  Just not when I hit it with a browser and hosted by IIS.
14 years ago
If you are running 64-bit windows then check the app pool is configured to enbale 32 bit apps

You can do this under advanced settings in IIS7 on the app pool

Ta
Ant
14 years ago
Would love to have an answer for you instead of a link to something that _might_ help, but I guess something is better than nothing!

http://objectmix.com/sharepoint/297402-request-permission-type-system-data-sqlclient-sqlclientpermission-system-data-version-2-0-0-0-culture-neutral-publickeytoken-b77a5c561934e089-failed.html

It's a bit of a long URL and it will take you to a discussion with a solution that seems to work for a variety of scenarios where an upgrade to a web solution such as SharePoint or any other ASP.NET app has taken place.

I hope you get this sorted!
14 years ago
Welovewines wrote:
If you are running 64-bit windows then check the app pool is configured to enbale 32 bit apps

You can do this under advanced settings in IIS7 on the app pool

Ta
Ant


Running Windows 7 Pro 64bit.  I've enabled 32bit apps in the app pool, that didn't fix it either.
14 years ago
You may need to "Unblock" the zip file before extracting too...

This comes from right clicking on the ZIP in the folder and going properties, unblock ZIP, re-extract and try running.
14 years ago
Ive just tested this on a fresh hyper-v win 7 ultimate ii7 install and the straight zip without unblocking caused the exception, i then removed the block and re-extracted/re-ran and it was fine.

Let me know how you get on.

Ta
14 years ago
Welovewines wrote:
You may need to "Unblock" the zip file before extracting too...

This comes from right clicking on the ZIP in the folder and going properties, unblock ZIP, re-extract and try running.


Ok, that seemed to do the trick.  This has to be the very first time I've ever encountered something like this -- very strange.

Andrei - you may want to go back to RAR for the distribution instead of zip ;)

Thanks for all the help folks -- I would have been chasing this one for a while!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.