ArticleDirectory
- Localreport. setbasepermissionsforsandboxappdomain Method
An error occurred during local report processing. Failed to load expression host assembly. Details: RequestForThe permission of Type'System. Security. permissions. securitypermission, mscorlib, version = 4.0.0.0, culture = neutral, publickeytoken = b77a5c561934e0
Solution: Set permissions for the localreport of reportviewer:
VaR reportinstance =NewLocalreport (); reportinstance. setbasepermissionsforsandboxappdomain (NewPermissionset (permissionstate. Unrestricted ));
I don't really understand why. I do understand that the report is being granted permissions it can't get from WIF, but I don't understand which permissions those are or why it needs them. so, my answer "gives a man a fish," but can someone else "Teach a man to fish" by explaining the deeper issue?
Localreport. setbasepermissionsforsandboxappdomain Method
The newly added method for vs2010. Use the provided permission set to set sandbox applicationsProgramThe basic permissions of the domain.
The basic permissions in the sandbox application domain are applied to customCodeCalculates the Assembly and report expression. Note that this method replaces all existing basic permission sets with the provided permission sets. You shall ensure that the provided permission set includesExecutionPermission. Otherwise, no custom code assembly can be executed and no expressions can be computed.
If you change the permission, make sure that you cannot use the localreport object to access any untrusted report definition. In. NET Framework 3.5 (or in. NET Framework 4 with legacysecuritypolicy enabled), you must explicitly call the executereportinsandboxappdomain method to switch to the sandbox application domain mode.
Http://msdn.microsoft.com/zh-cn/library/microsoft.reporting.webforms.localreport.aspx
Http://stackoverflow.com/questions/4794968/reporting-services-localreport-and-wif