I am using an external assembly on one of my report. This assembly simply
does some data reading, does some calculation, and updating a table, and is
working fine if called directly from an aspx page. However, if I call the
assembly from my report it fails with an error below:
Reporting Services Error
----
Failed to load expression host assembly. Details: Request for the permission
of type System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
(rsProcessingError)
----
I have given my assembly FullTrust permission in rsrvrpolicy.config.
System.Data.dll was also given FullTrust permission, but this did not solve
the problem.
FYI, my assembly was not written as a Reporting Services custom data
extension. I did not think about implementing one since the assembly itself
does not supply the data to my report. My report is still using a shared
data source defined in the report project.
Do I need to rewrite my assembly to a Reporting Services data extension
(using the data interfaces) for it to work with my reports?
Any help would be much appreciated. TIA.It sounds like you did not explicitly assert permissions to open a database
connection. Unless you assert (!) the permission explicitly in the custom
assembly code, it will fail with a security exception.
Example for opening a connection to a SQL Server:
...
SqlClientPermission permission = new
SqlClientPermission(PermissionState.Unrestricted);
try
{
permission.Assert(); // Assert security permission!
SqlConnection con = new SqlConnection("...");
con.Open();
...
}
BTW: you don't need FullTrust for using the SqlClient in a custom assembly,
because the SqlClient is enabled for partial trust scenarios. Unlike the
OracleClient - in case you are interested in the details about the
differences:
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=876d1ca1-b59f-4c77-9b06-2cd307aa951c&sloc=en-us
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"TechnoSpyke" <technospyke@.yahoo.com> wrote in message
news:%23$%23U$XVBFHA.2196@.TK2MSFTNGP14.phx.gbl...
> I am using an external assembly on one of my report. This assembly simply
> does some data reading, does some calculation, and updating a table, and
is
> working fine if called directly from an aspx page. However, if I call the
> assembly from my report it fails with an error below:
> Reporting Services Error
> ----
--
> Failed to load expression host assembly. Details: Request for the
permission
> of type System.Data.SqlClient.SqlClientPermission, System.Data,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
> (rsProcessingError)
> ----
--
> I have given my assembly FullTrust permission in rsrvrpolicy.config.
> System.Data.dll was also given FullTrust permission, but this did not
solve
> the problem.
> FYI, my assembly was not written as a Reporting Services custom data
> extension. I did not think about implementing one since the assembly
itself
> does not supply the data to my report. My report is still using a shared
> data source defined in the report project.
> Do I need to rewrite my assembly to a Reporting Services data extension
> (using the data interfaces) for it to work with my reports?
> Any help would be much appreciated. TIA.
>|||Hi Robert,
I have a custom assembly with 2 functions one using SqlClient for dataaccess
as below which is working fine with the assert, but I also have one using
System.DirectoryServices which i am trying to use with:
System.DirectoryServices.DirectoryServicesPermission pDir = new
DirectoryServicesPermission(System.Security.Permissions.PermissionState.Unrestricted);
pDir.Assert();
Unfortunately i am getting the following error:
"Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed."
Any ideas?
I cant seem to solve this one and there doesnt seem to be any help anywhere.
Thanks,
Flon Mackenzie
"Robert Bruckner [MSFT]" wrote:
> It sounds like you did not explicitly assert permissions to open a database
> connection. Unless you assert (!) the permission explicitly in the custom
> assembly code, it will fail with a security exception.
> Example for opening a connection to a SQL Server:
> ...
> SqlClientPermission permission = new
> SqlClientPermission(PermissionState.Unrestricted);
> try
> {
> permission.Assert(); // Assert security permission!
> SqlConnection con = new SqlConnection("...");
> con.Open();
> ...
> }
> BTW: you don't need FullTrust for using the SqlClient in a custom assembly,
> because the SqlClient is enabled for partial trust scenarios. Unlike the
> OracleClient - in case you are interested in the details about the
> differences:
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=876d1ca1-b59f-4c77-9b06-2cd307aa951c&sloc=en-us
> --
> Robert M. Bruckner
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "TechnoSpyke" <technospyke@.yahoo.com> wrote in message
> news:%23$%23U$XVBFHA.2196@.TK2MSFTNGP14.phx.gbl...
> > I am using an external assembly on one of my report. This assembly simply
> > does some data reading, does some calculation, and updating a table, and
> is
> > working fine if called directly from an aspx page. However, if I call the
> > assembly from my report it fails with an error below:
> >
> > Reporting Services Error
> > ----
> --
> >
> > Failed to load expression host assembly. Details: Request for the
> permission
> > of type System.Data.SqlClient.SqlClientPermission, System.Data,
> > Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
> > (rsProcessingError)
> >
> > ----
> --
> >
> > I have given my assembly FullTrust permission in rsrvrpolicy.config.
> > System.Data.dll was also given FullTrust permission, but this did not
> solve
> > the problem.
> >
> > FYI, my assembly was not written as a Reporting Services custom data
> > extension. I did not think about implementing one since the assembly
> itself
> > does not supply the data to my report. My report is still using a shared
> > data source defined in the report project.
> >
> > Do I need to rewrite my assembly to a Reporting Services data extension
> > (using the data interfaces) for it to work with my reports?
> >
> > Any help would be much appreciated. TIA.
> >
> >
>
>
No comments:
Post a Comment