gpt4 book ai didi

c# - 报告服务 : use a custom assembly with a local (RDLC) report

转载 作者:太空狗 更新时间:2023-10-29 22:29:07 26 4
gpt4 key购买 nike

我正在设计一个将在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com