System.Data.SqlClient.SqlClientPer mission Fail SSRS
Hi,
I created a custom dll to be used in reporting services.
In this custom dll I have a method that will querying a database and return values that I will use as parameters for my report, something like,
My report is expecting a division as parameter and as default value I set this expression
"= CustomDLL.ClassName.GetDivision(User!UserID)",
Inside the function I have something like this
"Select division from UserDivisions where UserID = @functionParameter"
I tried the dll and everything works fine but when I use it either in Report Builder or Report Designer (BI) it fire me with this error.
System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Some people suggest to make some changes in rspolicy.config file to pass this error, I have try all that without result,
One more thing I have Form Authentication in my SSRS.
Thanks in advance.
May 22nd, 2012 2:41pm
Hi,
This is a solution for anyone that run in this problem,
Important: make a copy of any config file that you need to modify!!!!!!!!!!!.
In the rssrvpolicy.config inside the Report Server folder, add this xml section inside the </NamedPermissionSets> tag.
<PermissionSet
class="NamedPermissionSet"
version="1"
Name="MyDllPermission">
<IPermission
class="SecurityPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
and then this other section as a CodeGroup
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="MyDllGroupCode"
Description="">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting
Services\ReportServer\bin\CustomFunctions.dll"/>
</CodeGroup>Change the name of CustomFunctions.dll to yours dll name.
Restart your Reporting Services
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2012 3:23pm
Upss I forgot something.
Before Use the System.Data.SqlClient namespace you most do this.
System.Data.SqlClient.SqlClientPermission pSql = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
//
try
{
pSql.Assert();
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SSRSConnection"].ConnectionString))
{
...............................
May 24th, 2012 3:26pm


