System.Security.SecurityException: Request failed.

Sep 29, 2009 at 7:20 AM

Hey guys,

I've gone through the documentation and install guides, gotten ASP.NET MVC configured, EF configured for mysql and made the proper changes for medium trust. I am however getting the following error when I try to go to http://www.unity3dnews.com.

Any idea what I may have done wrong or missed?

 

Server Error in '/' Application.

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 failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SecurityException: Request failed.]
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +284
System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh) +69
System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) +150
System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +30
System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +40
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +123
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant) +54

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

Sep 29, 2009 at 8:21 AM

I fixed it by setting <trust level="High"/> to <trust level="Full"> in my web.config

 

Now when I hit http://www.unity3dnews.com I see nothing...no error etc..

when I go to the Logs folder and open trace.csv I see the following in there...

 

"S15358757","9/29/2009 7:13:46 AM","Information","Kigg.Repository","LoggingUserRepository","FindByUserName(String userName)","Retrieving user with userName: admin","n/a","74.208.127.34","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)","/","/"
"S15358757","9/29/2009 7:13:47 AM","Information","Kigg.Repository","LoggingUserRepository","FindByUserName(String userName)","User retrieved with userName: admin","n/a","74.208.127.34","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)","/","/"
"S15358757","9/29/2009 7:13:47 AM","Information","Kigg.Repository","LoggingUserRepository","FindByUserName(String userName)","Retrieving user with userName: support","n/a","74.208.127.34","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)","/","/"
"S15358757","9/29/2009 7:13:47 AM","Information","Kigg.Repository","LoggingUserRepository","FindByUserName(String userName)","User retrieved with userName: support","n/a","74.208.127.34","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)","/","/"
"S15358757","9/29/2009 7:13:47 AM","Information","Kigg.Repository","LoggingUserRepository","FindByUserName(String userName)","Retrieving user with userName: bee","n/a","74.208.127.34","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)","/","/"
"S15358757","9/29/2009 7:13:47 AM","Information","Kigg.Repository","LoggingUserRepository","FindByUserName(String userName)","User retrieved with userName: bee","n/a","74.208.127.34","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)","/","/"
"S15358757","9/29/2009 7:13:47 AM","Information","Kigg.Web","GlobalApplication","Application_Start()","Application Started","n/a","74.208.127.34","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)","/","/"
"S15358757","9/29/2009 7:13:51 AM","Information","Kigg.Repository","LoggingStoryRepository","FindPublished(Int32 start, Int32 max)","Retrieving published stories : 0, 20","Unauthenticated User","74.208.127.34","Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3","/","/"
"S15358757","9/29/2009 7:13:51 AM","Warning","Kigg.Repository","LoggingStoryRepository","FindPublished(Int32 start, Int32 max)","Did not find any published story : 0, 20","Unauthenticated User","74.208.127.34","Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3","/","/"
"S15358757","9/29/2009 7:13:52 AM","Information","Kigg.Repository","LoggingCategoryRepository","FindAll()","Retrieving all Category","Unauthenticated User","74.208.127.34","Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3","/","/"
"S15358757","9/29/2009 7:13:52 AM","Warning","Kigg.Repository","LoggingCategoryRepository","FindAll()","Did not find any category","Unauthenticated User","74.208.127.34","Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3","/","/"
"S15358757","9/29/2009 7:13:52 AM","Information","Kigg.Repository","LoggingUserRepository","FindTop(DateTime startTimestamp, DateTime endTimestamp, Int32 start, Int32 max)","Retrieving top users : 1/11/2008 12:00:00 AM, 9/29/2009 7:13:52 AM, 0, 20","Unauthenticated User","74.208.127.34","Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3","/","/"

 

Any idea what could be going wrong? I am very close to deleting my site and starting from scatch (perhaps this time with the sourcecode and the sample configs in it just in case I messed upsomewhere while setting the config files up.).

Coordinator
Sep 30, 2009 at 9:21 PM
Edited Sep 30, 2009 at 9:22 PM

Hi,

Just a note before you go further, if you want to work on Medium trust you'll need to grant SocketPermission. Because MySQLClient uses sockets. however if you are using Windows 7 or Windows 2008 R2 EF has known issue with
Medium trust already.

Before you delete your site, can you please check the exception.log file! Maybe there is something interesting?! I recommend that you delete the existing one and restart your application.

Also Try to deploy it locally first to get your hands on deployment steps. And try to follow the deployment guide it is not yet complete, but it can give you a push.

In part 2 of the deployment there is sample configuration that you can use it as starter when you follow the guide. You'll find it under the introduction section.

If you wish to let me help you through the deployment on your live server let me know, but this will require to give me temporary access to your server.