FileIoPermission in custom assembly in ssrs 2008 report


  • I have custom assembly which takes in text input by the user and generate a image file which is displayed in the report.
    The assembly works when run with a windows form but I recieve this error from the report preview in  vs2008.

    [rsRuntimeErrorInExpression] The Value expression for the image  contains an error: System.Security.Permissions.SecurityPermission  

    I have tried to place fileiopermission to the individual functions as well as the assembly

    <Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, Unrestricted:=True

    for each method



    gkdbut in vain. Any help appreciated.

    Tuesday, August 04, 2009 6:38 PM


  • Hi Gkd,


    From your description, you want to implement a custom assembly into the Reporting Services 2008. However, you got the permission error.


    The error is caused by the code does not have sufficient privileges to access the file system.

    Code access security centers around these core concepts: evidence, code groups, and named permission sets. In Reporting Services, the Report Manager, Report Designer, and Report Server components each have a policy file that configures code access security for custom assemblies as well as data, delivery, rendering, and security extensions.


    Reporting Services uses code access security because, although the report server is built on ASP.NET technology, there is a substantial difference between a typical ASP.NET application and the report server. A typical ASP.NET application does not execute user code. In contrast, Reporting Services uses an open and extensible architecture that allows users to program against the report definition files using the Code element of the Report Definition Language and to develop specialized functionality into a custom assembly for use in reports. Furthermore, developers can design and deploy powerful extensions that enhance the capabilities of the report server. With this power and flexibility comes the need to provide as much protection and security as possible.


    Reporting Services developers can use any .NET Framework assembly in their reports and natively call upon all of the functionality of assemblies deployed to the global assembly cache. The only thing that the report server can control is what permissions are given for report expressions and loaded custom assemblies. In Reporting Services, custom assemblies receive Execute-only permissions by default.



    To solve the issue, please add the assembly to code group and give the assembly full control permission.


    If the solution above does not help, please send us the rsreportserver.config and the rssrvpolicy.config file. If possible, send the report sample and the assembly also.


    For more information about how to configure the code access security, please see:


    Jin Chen

    Jin Chen - MSFT
    Thursday, August 06, 2009 6:15 AM