Tuesday, January 28, 2014

SSRS: System.Security.Permissions.SecurityPermission

I install the assembly in GAC and reference the dll in a report template. When I use a custom dll to generate barcode in SSRS, an error message is shown.
"Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

I know that it's something about the permission issue. But I don't have any idea on it. After that, I find out that the configuration of reporting server and report designer are two different thing. And my target is reporting server only.

(1). Register dll in GAC

(2). Grant full trust in rssrvpolicy.config
<CodeGroup class="UnionCodeGroup"
   version="1"
   PermissionSetName="FullTrust"
   Name="ThisDataProviderCodeGroup"
   Description="Code group for the .NET data provider">
      <IMembershipCondition class="UrlMembershipCondition"
         version="1"
         Url=
"C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin\DataProviderAssembly.dll"
       />
</CodeGroup>

After restarting the reporting services, I upload the report to my reporting server and the report works well.