Saturday, February 25, 2012

Deployed report with custom assembly fail when calling web service

Hi,
I'm developing a report that calls a web service using a custom assembly.
I've got the code working in VS.NET, but when I deploy to my local Report
Server, I get this:
System.Security.SecurityException: Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed
I have added the following to RSReportServer.config:
<CustomAssemblies>
<Assembly Name="cmcs.wsclient.dll, Version=1.0.xxx.xxxx,
Culture=neutral, PublicKeyToken=xxx">
<PermissionSet class="System.Security.PermissionSet">
<IPermission
class="System.Security.Permissions.SecurityPermission"
version="1"
Flags="Execution, Assertion"
/>
<IPermission class="System.Security.Permissions.WebPermission"
version="1"
Unrestricted="true"
/>
<IPermission
class="System.Security.Permissions.EnvironmentPermission"
version="1"
Unrestricted="true"
/>
</PermissionSet>
</Assembly>
<Assembly Name="cmcs.msrs.webserviceclient, Version=1.0.xxx.xxxx,
Culture=neutral, PublicKeyToken=xxx">
<PermissionSet class="System.Security.PermissionSet">
<IPermission
class="System.Security.Permissions.SecurityPermission"
version="1"
Flags="Execution, Assertion"
/>
<IPermission class="System.Security.Permissions.WebPermission"
version="1"
Unrestricted="true"
/>
<IPermission
class="System.Security.Permissions.EnvironmentPermission"
version="1"
Unrestricted="true"
/>
</PermissionSet>
</Assembly>
<Default>
<PermissionSet class="System.Security.PermissionSet">
<IPermission
class="System.Security.Permissions.SecurityPermission"
version="1"
Flags="Execute"
/>
</PermissionSet>
</Default>
</CustomAssemblies>
In rssrvpolicy.config, I have changed the PermissionSet for
Report_Expressions_Default_Permissions to FullTrust and added the following:
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Attributes="LevelFinal"
Name="ReportServer-cmcs.msrs.webserviceclient"
Description="Codegroup generated by the .NET
Configuration tool">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="file://C:/Program
Files/Microsoft SQL Server/MSSQL/Reporting
Services/ReportServer/bin/cmcs.msrs.webserviceclient.dll"/>
</CodeGroup>
It works to call a HelloWorld method returning a string from the custom
assembly, so there is no total failure, but calling the method to invoke the
web service fails.
Please help, I feel that I'm totally stuck!
JonasBy moving my CodeGroup in rssrvpolicy.config to right under the first
default CodeGroup, it I got it to work ...
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="Nothing">
<IMembershipCondition
class="AllMembershipCondition"
version="1"
/>
***** RIGHT UNDER HERE *****
It seems like my CodeGroup wasn't used by ReportServer until the move. We'll
just have to see how long time it will work before it breaks again ;-)
Jonas" <Jonas@.nospam.pl> wrote in message
news:u$YVj30IGHA.1032@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I'm developing a report that calls a web service using a custom assembly.
> I've got the code working in VS.NET, but when I deploy to my local Report
> Server, I get this:
> System.Security.SecurityException: Request for the permission of type
> System.Security.Permissions.SecurityPermission, mscorlib,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed
> I have added the following to RSReportServer.config:
> <CustomAssemblies>
> <Assembly Name="cmcs.wsclient.dll, Version=1.0.xxx.xxxx,
> Culture=neutral, PublicKeyToken=xxx">
> <PermissionSet class="System.Security.PermissionSet">
> <IPermission
> class="System.Security.Permissions.SecurityPermission"
> version="1"
> Flags="Execution, Assertion"
> />
> <IPermission class="System.Security.Permissions.WebPermission"
> version="1"
> Unrestricted="true"
> />
> <IPermission
> class="System.Security.Permissions.EnvironmentPermission"
> version="1"
> Unrestricted="true"
> />
> </PermissionSet>
> </Assembly>
> <Assembly Name="cmcs.msrs.webserviceclient, Version=1.0.xxx.xxxx,
> Culture=neutral, PublicKeyToken=xxx">
> <PermissionSet class="System.Security.PermissionSet">
> <IPermission
> class="System.Security.Permissions.SecurityPermission"
> version="1"
> Flags="Execution, Assertion"
> />
> <IPermission class="System.Security.Permissions.WebPermission"
> version="1"
> Unrestricted="true"
> />
> <IPermission
> class="System.Security.Permissions.EnvironmentPermission"
> version="1"
> Unrestricted="true"
> />
> </PermissionSet>
> </Assembly>
> <Default>
> <PermissionSet class="System.Security.PermissionSet">
> <IPermission
> class="System.Security.Permissions.SecurityPermission"
> version="1"
> Flags="Execute"
> />
> </PermissionSet>
> </Default>
> </CustomAssemblies>
> In rssrvpolicy.config, I have changed the PermissionSet for
> Report_Expressions_Default_Permissions to FullTrust and added the
following:
> <CodeGroup class="UnionCodeGroup"
> version="1"
> PermissionSetName="FullTrust"
> Attributes="LevelFinal"
>
Name="ReportServer-cmcs.msrs.webserviceclient"
> Description="Codegroup generated by the .NET
> Configuration tool">
> <IMembershipCondition class="UrlMembershipCondition"
> version="1"
> Url="file://C:/Program
> Files/Microsoft SQL Server/MSSQL/Reporting
> Services/ReportServer/bin/cmcs.msrs.webserviceclient.dll"/>
> </CodeGroup>
> It works to call a HelloWorld method returning a string from the custom
> assembly, so there is no total failure, but calling the method to invoke
the
> web service fails.
> Please help, I feel that I'm totally stuck!
> Jonas
>

No comments:

Post a Comment