views:

247

answers:

3

I changed the trust level for my application to "Full" but I'm still getting the following error in Windows 7. I followed the steps for using subsonic, but it appears I'm missing something.

Security Exception 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 3403:                this.SetKeyValue(newKey);
 Line 3404:            }else{
 Line 3405:                _repo.Add(this,provider);
 Line 3406:            }
 Line 3407:            SetIsNew(false);

 Source File: C:\src\gillisonlab.osumc.edu\Apps\OhioS3\OhioS3\ActiveRecord.cs
 Line: 3405
+1  A: 

If you're running on 64 bit Windows you must remember to make changes to both the 32 bit and 64 bit .NET Framework configuration files:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config

Kev
A: 

Seeing the same thing here with Subsonic 3 on Windows 7 64bit. Setting full trust in web.config didn't help. I did get past the error by changing the App pool identity account to an admin account.

Gerry

Gerry
I've been beating myself up over this exact problem for the past two days. Changing the Application Pool's identity account to the admin account worked for me, too... but by "worked" have we left our machines... "unbelievably vulnerable"? I'll be following up with a question on ServerFault later today and will cross-link the two.
Bob Kaufman
+1  A: 

I solved this by setting "Load User Profile" to true on the Advanced Settings for the application pool.

I'm not sure why this works exactly but I think it's more secure than setting it to run as the administrator.

Rob Stevenson-Leggett