custom assembly and ssrs 2005 RRS feed

  • Question

  • i deigned assembly and referced it to my report in preview

    when deployed the report , i get #Error

    i don't add any cas code.

    pls help


    Friday, March 28, 2008 9:49 AM

All replies

  • Hi,


    You have to give sufficient permission to the assembly on the report server. You can refer to this KB article:



    Friday, March 28, 2008 10:01 AM

    failed also


    i applied all instruction except that my framework is 2 and i don't have folder "Drive:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\rspreviewpolicy.config folder."



    Friday, March 28, 2008 1:12 PM
  • Hello,


    Are you referening an other custom assembly or an native DLL in your custom assembly ? If yes, you need to propogate CAS permissions to these assemblies.


    In case you are calling an unmanaged DLL from your  custom  assembly.


    1. Add the appropriate attribute to you assembly class: <SecurityPermission(SecurityAction.Assert, UnmanagedCode:=True)>

    2. Allow the assembly to be called by partially trusted callers: <Assembly: AllowPartiallyTrustedCallers()>
    a. This declaration goes into AssemblyInfo.vb
    b. AllowPartiallyTrustedCallers is in the System.Security namespace


    In case you are creating an object of a managed class in your custom assembly, you would have to use .Assert() method


    - Runeet
    Friday, March 28, 2008 1:59 PM
  • many thanks for co-operation but i don't have good experience in dll files


    what you mean by custom assembly or an native DLL?


    i designed the dll as following:



    Imports system.Security

    Imports System.Security.Permissions

    Imports system

    <Assembly: AllowPartiallyTrustedCallers()>

    <SecurityPermission(SecurityAction.Assert, UnmanagedCode:=True)>



    Public Class CodeReportingFunctions

    Shared Function Gettotalgov(ByVal ID As Integer, ByVal year_study As String, ByVal term As String) As Decimal


    Dim oPerm As New Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted)


    Dim oConn As New System.Data.SqlClient.SqlConnection

    oConn.ConnectionString = "Data Source=;Initial Catalog=control;Integrated Security=True"



    Dim oCmd As New System.Data.SqlClient.SqlCommand

    oCmd.Connection = oConn

    Dim s As String

    s = "SELECT count(*) from temp"

    oCmd.CommandText = s

    Dim nRetVal As Decimal = 0

    nRetVal = oCmd.ExecuteScalar()


    Return nRetVal


    Catch ex As Exception


    End Try

    End Function

    end sub



    and i add the following to :

    C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\rssrvpolicy.config:

    <PermissionSet class="NamedPermissionSet"
    Name="TestPermissions ">
    <IPermission class="SecurityPermission"
    Flags="Assertion, Execution"/>



    and after close Url="$CodeGen$/*" /></CodeGroup>:


    <CodeGroup class="UnionCodeGroup"
    PermissionSetName="TestPermissions "
    <IMembershipCondition class="UrlMembershipCondition"


    i still get error  if i used assembly or embeded code pls i need it urgent


    Friday, March 28, 2008 3:25 PM