locked
Image from custom assembly RRS feed

  • Question

  • What I want to do is exactly what this thread describes http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/8a1d34d4-b6e7-4e8e-b2a2-1f328a5e6505

    This thread is marked resolved but I don't know what the solution was. I can call my assembly dll without a problem but the image(bar code) returned from my dll isn't being displayed.
    Thursday, February 11, 2010 10:19 PM

Answers

  • Hi awu255,

    I have tested the same thing you have mentioned. Everything works fine.
    Below are the detailed steps for your reference:
    1.Create a assembly(Class Library) that is used to generate a image. The return type must be byte[].
    2.Deploy the assembly.
        a. Copy the file to these folders:
            > C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin
            > C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\Bin
            > C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies
        b. Change the code security settings in rssrvpolicy.config and rsmgrpolicy.config
               We need to add the following code group under element "FirstMatchCodeGroup (Description="This code group grants MyComputer code Execution permission. ")" in rssrvpolicy.config 
               
                                 <CodeGroup
      class="UnionCodeGroup"
      version="1"
      Name="SecurityExtensionCodeGroup"
      Description="Code group for the sample security extension"
      PermissionSetName="FullTrust">
                    <IMembershipCondition
                      class="UrlMembershipCondition"
                      version="1"
                      Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\GenerateImage.dll" />
                  </CodeGroup>

               We need to add the following code group under element "FirstMatchCodeGroup (Description="This code group grants MyComputer code Execution permission. ")"  in rsmgrpolicy.config 

                                                            <CodeGroup
      class="UnionCodeGroup"
      version="1"
      Name="SecurityExtensionCodeGroup"
      Description="Code group for the sample security extension"
      PermissionSetName="FullTrust">
                                <IMembershipCondition
                                  class="UrlMembershipCondition"
                                  version="1"
                                  Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\bin\GenerateImage.dll" />
                              </CodeGroup>
                 
                 
    3. Call the assembly from report
        a. Drag a image control to the report body.
        b. Set the Image Datasource to be "Database"
        c. Set the expression for the "Use this field" textbox: =(New NameSpace.Class(arguments)).Function(arguments)
        d. Select an appropriate MIME type.

    4.Deploy the report.
    Please note the highlight text in the steps.

    Now, we are able to generate image dynamically.

    By the way, I have implemented a sample here, that will help to understand the steps:
    http://cid-3c7e963ff6ccd974.skydrive.live.com/self.aspx/.Public/GenerateImageDynamically.zip
    (NOTE: The configureation files in the package is just for you information. Please do NOT replace your configuration files with these one)

    Please feel free to ask, if you have any more questions.

    Thanks,
    Jin Chen

    Jin Chen - MSFT
    • Marked as answer by awu255 Thursday, February 18, 2010 1:41 AM
    Tuesday, February 16, 2010 9:01 AM