Search This Blog

Thursday, November 21, 2013

system.security.securityexception: request for the permission of type 'system.security.permissions.securitypermission, mscorlib, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' failed


Reference:
http://codesnipets.wordpress.com/2010/12/25/sharepoint-2010-and-asp-net-web-application-security-exception/

You might get following error “System.Security.SecurityException: Request for the permission of type ‘System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.
specially when you have asp.net web application configured under Share point Virtual Directoryand you try to access web service or write a log file or try to call method from custom assembly.
The reason you get this error is your asp.net web application runs under WSS_Minimal trust.
Solution
In IIS, Select your sharepoint virtual directory and go to Features view.
In features view select .NET Trust Levels.
In .NET Trust Level you will see default WSS_Minimal trust. Change it to Full Trust and re-start web application.

No comments:

Post a Comment