Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reporting Services LocalReport and WIF

I have a wcf webservice that uses WIF for authentication. Part of the responsibility of this webservice is to generate a report and email it. If I render the report with data only everything is fine. If I include any report parameters, report constants, or even just DateTime.Now I get the following exception:

An error occurred during local report processing.Failed to load expression host assembly. Details: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

I can run the same report in a WCF service that does not use WIF, so clearly something about the security environment is fubarred.

I really don't know how to proceed with solving this problem. Can anyone help? Thanks!

like image 630
Chris McKenzie Avatar asked Jan 25 '11 14:01

Chris McKenzie


1 Answers

This works:

var reportInstance = new LocalReport();
reportInstance.SetBasePermissionsForSandboxAppDomain(new PermissionSet(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?

like image 127
Chris McKenzie Avatar answered Nov 23 '22 12:11

Chris McKenzie