Thursday, March 29, 2012

Error accessing registry value in report

We store environment specific information in the registry to ease moving from
dev, test and production environments. I'm making a call in the code window
to read from the registry and am getting this error:
Failed to load expression host assembly. Details: Request for the permission
of type System.Security.Permissions.RegistryPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
(rsProcessingError) Get Online Help
Just as a test I've changed all code access security zones to Full Trust but
this hasn't helped.
Please advise.This is what I had to do to get this working, if anyone's interested:
Edit C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\rssrvpolicy.config and modify the entry in the
Report_Expressions_Default_Permissions CodeGroup and change it from Execute
to FullTrust.
"Aaron" wrote:
> We store environment specific information in the registry to ease moving from
> dev, test and production environments. I'm making a call in the code window
> to read from the registry and am getting this error:
> Failed to load expression host assembly. Details: Request for the permission
> of type System.Security.Permissions.RegistryPermission, mscorlib,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
> (rsProcessingError) Get Online Help
> Just as a test I've changed all code access security zones to Full Trust but
> this hasn't helped.
> Please advise.
>|||Giving FullTrust to Report_Expressions_Default_Permissions totally opens
your server for hacker attacks. Now all expressions incliding VB.NET
snippets in Report.Code have fulltrust which allows them to perform any
operations, including formatting drives, reading and writing files etc...
The better way is to create a custom assembly with functions to read
registry and call this assembly from your reports. You will then give only
RegistryPermission to that assembly.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aaron" <Aaron@.discussions.microsoft.com> wrote in message
news:281FF58C-043F-40DA-AFCF-4C413BFC2A49@.microsoft.com...
> This is what I had to do to get this working, if anyone's interested:
> Edit C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportServer\rssrvpolicy.config and modify the entry in the
> Report_Expressions_Default_Permissions CodeGroup and change it from
Execute
> to FullTrust.
>
> "Aaron" wrote:
> > We store environment specific information in the registry to ease moving
from
> > dev, test and production environments. I'm making a call in the code
window
> > to read from the registry and am getting this error:
> >
> > Failed to load expression host assembly. Details: Request for the
permission
> > of type System.Security.Permissions.RegistryPermission, mscorlib,
> > Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.
> > (rsProcessingError) Get Online Help
> >
> > Just as a test I've changed all code access security zones to Full Trust
but
> > this hasn't helped.
> >
> > Please advise.
> >|||Aaron I have done similar kind of thing, If your still facing the problem
write to me, I can help you out to fix the issue.
My Email ID:
balajikkrishnan [AT] rediffmail [DOT] com
Thanks
Balaji
--
Message posted via http://www.sqlmonster.comsql

No comments:

Post a Comment