Centralising Reporting Services Stylesheets

  • Hi sbygrave,

    I can only suggest (untried and untested) that SQL Server replication from a central point to the departmental servers could possibly do the trick.

    After all, it is extremely lightweight and rarelychanging data.

    Regards,

    Adam

  • Yes I was thinking that we could use replication for the Style table(s) but...

    How do I access the tables from within the CAS? At the moment I am hard coding the server name in there (using integrated security) and I do not want to have to create a different CAS for each location. Being able to use the shared data source from within the CAS would do it but, as I said before, I can't see how to do this.

    I suppose I could have a config file, but that seems a retrograde step to me?

    Thanks again

    Steve

  • Again, off the top of my head, how about "localhost" - I have used this in SSIS scripts, it might work here - if I have understood! Of course, you will need the same database name in each location.

  • I know it's against Contractor principles but, I was thinking about this at the weekend and it occurred to me that I had missed the point that the dll is copied to the local server. Therefore to make this code work, no matter the name or location of the server, is to simply use local server.

    Thanks again

    Steve

  • Hopefully Adam, or someone else can answer this one.

    Everything works wonderfully on my local workstation with the compiled DLL style library.

    The issue is when I copy the DLL for deployment into the reportServer folder on the development IIS server (where SSRS is installed) it is definitely NOT working.

    One issue may be the DLL (SSRS in general) is in a completely different folder than on my workstation, and VisualStudio is not installed on the server, so putting the DLL in there not even possible.

    What to do? Do the development DLL and the deployed on have to have the same reference paths? If they do, I'm sunk as the C: drives on company servers are a "no apps" zone (available only to system admins) and I don't have a "D" drive (which IS the user apps drive on company servers).

  • I created a dll using C#. I'm getting this "warning":

    Warning 2 [rsRuntimeErrorInExpression] The Value expression for the textrun ‘Textbox4.Paragraphs[0].TextRuns[0]’ contains an error: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. C:\Documents and Settings\... 0 0

    Here's the expression: =RSStyleLibrary.RSStyleSheet.ReportStyleGet("Color", "Accounting", "Header")

    Class file code

    using System;

    using System.Collections.Generic;

    using System.Text;

    using System.Data;

    using System.Data.SqlClient;

    using System.Collections;

    namespace RSStyleLibrary

    {

    public class RSStyleSheet

    {

    public static string ReportStyleGet(string StyleType, string StyleFamily, string StyleCategory)

    {

    //StyleType = "Color";

    //StyleFamily = "Accounting";

    //StyleCategory = "Header";

    string RetVal;

    SqlConnection conn = new

    SqlConnection("server;database;User ID;Password);

    SqlCommand USP_ReportStyleGet = new SqlCommand("USP_ReportStyleGet", conn);

    USP_ReportStyleGet.CommandType = CommandType.StoredProcedure;

    USP_ReportStyleGet.Parameters.AddWithValue("@StyleType", StyleType);

    USP_ReportStyleGet.Parameters.AddWithValue("@StyleFamily", StyleFamily);

    USP_ReportStyleGet.Parameters.AddWithValue("@StyleCategory", StyleCategory);

    conn.Open();

    RetVal = USP_ReportStyleGet.ExecuteScalar().ToString();

    conn.Close();

    return (string)RetVal;

    }

    }

    }

    Any help would be greatly appreciated.

  • Hi Sinh,

    I have no idea off the top of my head about this one. I will have to spend some time looking at the deeper security implications of this process - but finding the time at the moment is difficult.

    Did you try signing the assembly using a strong key file?

    Regards,

    Aam

  • Hi Sinn

    I have no idea about C# but when I did this in vb.net I had to play with security issues:

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

    oPerm.Assert()

    May be worth you checking this out?

    Cheers

    Steve

  • Hi Steve & Sinh,

    You could need to look at:

    adding a code group to the rssrvpolicy.config - http://support.microsoft.com/kb/842419 (explains this particular error)

    or:

    http://msdn.microsoft.com/en-us/library/ms154466(SQL.90).aspx

    - for an overview of custom assembly security.

    Let us all know what exactly you have to do!

    Regards,

    Adam

  • But i face a strange problem.

    In SQLServer 2005 environment (enterprise&standard edition) when i use this DLL ,

    the solution works gr8 if we preview the report using BIS. But if we deploy the report and view via report manager, the report comes up , but WITHOUT applying the style.

    i have placed the DLL in the locations mentioned in the article... but no luck

    Any ideas?

    Thanks,

    Arunvijay

    PS : Please ignore my previous post , where i have told that this solution works in enterprise edition , but doesnt work in standard edition .

  • OOPs- My apologies to all who hit permissions problems, you need to add something like:

    "CodeGroup class="UnionCodeGroup"

    version="1"

    PermissionSetName="FullTrust"

    Name="MyCodeGroup"

    Description="Code group for my data processing extension">

    "

    To the rssrvpolicy.config file (probably in Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\)

    This is adapted from : http://support.microsoft.com/kb/920769

    Where you can find more details.

  • Hi.

    Did you ever get this to work? I am pulling my hair out changing the various policy configuration files adding 'Code Groups' and 'Permissions Sets'. I've followed the MS Knowledge base articles and spends 2 days trawling various resource trying to find the magic that will make this work, but right now its a big NO NO.

    What probably worse is I don't actually get any errors. Deployed report runs fine. I just don't get any of my db defined styles. As many other people on here have said, it all works beautifully in BIDS preview mode.

    Any light you could shed on this would be great.

    Martin

  • Just a word of advice (after two days of trial and error!) you need to edit C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.config to grant the assembly the correct security permisions in order to get the code in the tutorial to work correctly.

    Just add in a new code group with the url of your custom assembly and give it 'FullTrust' permissions. The System.Security.Permissions failed error.

  • Hi all,

    I do have the same problem with the security of the dll in ReportServer. :crazy:

    Are there some good resource who know the solution?

    Regards

    René

  • 😀 Hi all,

    I could fix my permission problem. I add the following code to the assembly:

    Imports System.Security.Permissions

    Public Class DataDrivenStyleLibrary

    Public Shared Function dbStyle(ByVal inputStyle As String, ByVal InputStyleType As String) As String

    Dim permission As SqlClientPermission = New SqlClientPermission(PermissionState.Unrestricted)

    permission.Assert()

    sStyle = ""

    I found the trick here http://softwareexpertsolutions.blogspot.com/2007/06/creating-and-deploying-reporting.html

    I added in rssrvpolicy.config my code group like:

    <CodeGroup class="UnionCodeGroup"

    version="1"

    PermissionSetName="FullTrust"

    Name="DynamicStyleLibrary"

    Description="Dynamic Reports">

    <IMembershipCondition

    class="UrlMembershipCondition"

    version="1"

    Url="C:\Program Files\Microsoft SQL Server\MSSQL.X\Reporting Services\ReportServer\bin\DynamicStyleLibrary.dll"/>

    </CodeGroup>

    I restarted IIS & RS .

    I hope this will solve the other issue as well.

    Many thanks for this great blog.

    Regards,

    René

Viewing 15 posts - 46 through 60 (of 70 total)

You must be logged in to reply to this topic. Login to reply