问题描述
我有一个使用 WIF 进行身份验证的 wcf 网络服务.此网络服务的部分职责是生成报告并通过电子邮件发送.如果我只用数据呈现报告,一切都很好.如果我包含任何报告参数、报告常量,甚至只是 DateTime.Now,我会收到以下异常:
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
我可以在不使用 WIF 的 WCF 服务中运行相同的报告,所以很明显,安全环境的某些方面是模糊的.
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!
推荐答案
这有效:
var reportInstance = new LocalReport();
reportInstance.SetBasePermissionsForSandboxAppDomain(new PermissionSet(PermissionState.Unrestricted));
我真的不明白为什么.我知道报告被授予了它无法从 WIF 获得的权限,但我不明白这些权限是什么,或者为什么需要它们.所以,我的回答是给人一条鱼",但其他人可以通过解释更深层次的问题来教人钓鱼"吗?
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?
这篇关于Reporting Services LocalReport 和 WIF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!