|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 2:13 PM
Points: 191,
Visits: 565
|
|
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.
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Today @ 2:10 AM
Points: 81,
Visits: 848
|
|
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
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, February 25, 2010 5:15 AM
Points: 4,
Visits: 35
|
|
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
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Today @ 2:10 AM
Points: 81,
Visits: 848
|
|
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
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Wednesday, November 07, 2012 5:15 AM
Points: 51,
Visits: 275
|
|
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 .
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Today @ 2:10 AM
Points: 81,
Visits: 848
|
|
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"> version="1" Url="C:\pathtocustomassembly\fixedstylelibrary.dll" /> "
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.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, October 30, 2012 2:46 AM
Points: 5,
Visits: 86
|
|
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
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, June 27, 2012 5:00 AM
Points: 1,
Visits: 61
|
|
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.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 4:26 AM
Points: 2,293,
Visits: 1,099
|
|
Hi all,
I do have the same problem with the security of the dll in ReportServer. 
Are there some good resource who know the solution?
Regards René
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 4:26 AM
Points: 2,293,
Visits: 1,099
|
|
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é
|
|
|
|