作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在设计一个将在 Winform 应用程序中以本地模式(RDLC 文件)使用的报告。我有一个带有静态类的自定义程序集,该类具有一些我想在报告中使用的函数(作为表达式)。
我找到了使用 RDL 报告执行此操作的各种帮助,但我的 RDLC 报告遇到了权限问题。
我在运行时收到以下错误:“报告引用了代码模块(我的模块),它不是受信任的程序集”。
我知道这是某种代码安全问题,但我不确定如何解决它。我在网上看到的文档是针对 RDL 报告的,它指示我编辑 SQL Server 特定的策略文件。我正在使用 RDLC,因此不涉及 sql server。我需要做什么才能获得适当的权限?
最佳答案
尝试使用 AddTrustedCodeModuleInCurrentAppDomain的方法 ReportViewer.LocalReport Property (reportViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain(“您的程序集”))。
还要确保使用 AllowPartiallyTrustedCallers属性与您的程序集 ([assembly:AllowPartiallyTrustedCallers])。
关于c# - 报告服务 : use a custom assembly with a local (RDLC) report,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2503886/
我是一名优秀的程序员,十分优秀!