none
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:

    http://support.microsoft.com/kb/842419/en-us

     

     

    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

    http://support.microsoft.com/kb/842419/

     

    - 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)

    oPerm.Assert()

    Dim oConn As New System.Data.SqlClient.SqlConnection

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

    Try

    oConn.Open()

    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()

    oConn.Close()

    Return nRetVal

     

    Catch ex As Exception

    MsgBox(ex.Message.ToString)

    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"
    version="1"
    Name="TestPermissions ">
    <IPermission class="SecurityPermission"
    version="1"
    Flags="Assertion, Execution"/>
    </PermissionSet>

     

     

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

     

    <CodeGroup class="UnionCodeGroup"
    version="1"
    PermissionSetName="TestPermissions "
    Name="TestCodeGroup"
    Description="">
    <IMembershipCondition class="UrlMembershipCondition"
    version="1"
    Url="C:\test\ReportingLibrary.dll"/>
    </CodeGroup>

     

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

     

    Friday, March 28, 2008 3:25 PM