"Request for the permission of type
Microsoft.SharePoint.Security.SharePointPermission,
Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c failed"
you can resolve this error by change the trust level in your webconfig file.
You can specify a level of trust that corresponds to a predefined set of permissions for ASP.NET applications. By default, ASP.NET defines the following trust levels:
Full
High
Medium
Low
Minimal
With the exception of the Full trust level, all trust levels grant only partial trust to the application folder of a virtual server instance. For more information on the ASP.NET trust levels
steps to change this security level :
1) local_drive:\Inetpub\wwwroot\wss\VirtualDirectories\yoursite\web.config
2) search for "trust" and change the level to be "Full"
it will look like this
<trust level="Full" originUrl="" />