Report Builder custom method of assembly returns “#Error”

旧巷老猫 提交于 2019-12-25 05:28:11

问题


I am currently trying to add an assembly into report builder 3.0 to execute a method and return the result:

But I always get "#Error" in the preview. Even whe the method is that simple:

public static string Test()
    {
        return "test";
    }

Reference is set the following:

Expression is:

=TestNamespace.TestClass.Test()

The assembly is registered in GAC and it seems that the method is being checked for availableness. Elsewise I get a different error.


回答1:


I finally fixed it.

Important is to set the following into AssemblyInfo.cs file:

using System.Security;
[...]
// added to use in Reporting Services
[assembly: AllowPartiallyTrustedCallers()]

More info:

http://www.sqlservercentral.com/blogs/dknight/2012/01/26/ssrs-custom-code-with-external-assemblies/ rsErrorLoadingCodeModule: what are the steps to deploy an assembly for use with Report Builder 2.0?

It is also not required to put the Assembly file in GAC. I simply put it here to test it locally:

C:\Program Files (x86)\Microsoft SQL Server\Report Builder 3.0


来源:https://stackoverflow.com/questions/16943653/report-builder-custom-method-of-assembly-returns-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!