Home All Groups Group Topic Archive Search About

Request for Permission failed

Author
16 Feb 2006 2:03 AM
Craig
I have an assembly that I wrote in .NET 2.0 for Reporting Services.

It essentially attaches to an Oracle DB and gets back a dataset.

I tried it out by a test windows application and it worked fine, however
when I try and run it within Reporting Services I get...

System.Security.SecurityException was unhandled by user code
  Message="Request for the permission of type
'System.Data.OracleClient.OraclePermission, System.Data.OracleClient,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
  Source="mscorlib"
  StackTrace:
       at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
       at System.Security.PermissionSet.Demand()
       at System.Data.Common.DbConnectionOptions.DemandPermission()
       at System.Data.OracleClient.OracleConnection.PermissionDemand()
       at
System.Data.OracleClient.OracleConnectionFactory.PermissionDemand(DbConnection
outerConnection)
       at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OracleClient.OracleConnection.Open()
       at Cambrex.ReportRoutines.GetParameterValue(String sConnection,
String sCompanyCode, String sName, String sDatabase)
       at ReportExprHostImpl.textbox22_TextBoxExprHost.get_ValueExpr()
       at
Microsoft.ReportingServices.ReportProcessing.ReportRuntime.EvaluateTextBoxValueExpression(TextBox
textBox)

Which has kind of thrown me.  My assembly I wrote is Strong Named and in the
GAC.  When I check the zone of the exception it is MyComputer which has Full
Trust so I am not too sure whats causing the problem.

Any ideas?

Thanks,

Craig

Author
16 Feb 2006 2:21 PM
Narendra
Hi,
  I think it is case of proper authentication/authorization configuration. I
have not worked iwth oracle but following Couple of questions would help you
to understand
1. How do you make database connection? (e.g windows authentication/ SQL
authentication in MS-SQL)
2. Do you use any user name for database connection? if yes, please check,
it has been granted an access.

or you can send code where you are gettting an error.......
regards,
narendra.

Show quoteHide quote
"Craig" wrote:

> I have an assembly that I wrote in .NET 2.0 for Reporting Services.
>
> It essentially attaches to an Oracle DB and gets back a dataset.
>
> I tried it out by a test windows application and it worked fine, however
> when I try and run it within Reporting Services I get...
>
> System.Security.SecurityException was unhandled by user code
>   Message="Request for the permission of type
> 'System.Data.OracleClient.OraclePermission, System.Data.OracleClient,
> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
>   Source="mscorlib"
>   StackTrace:
>        at System.Security.CodeAccessSecurityEngine.Check(Object demand,
> StackCrawlMark& stackMark, Boolean isPermSet)
>        at System.Security.PermissionSet.Demand()
>        at System.Data.Common.DbConnectionOptions.DemandPermission()
>        at System.Data.OracleClient.OracleConnection.PermissionDemand()
>        at
> System.Data.OracleClient.OracleConnectionFactory.PermissionDemand(DbConnection
> outerConnection)
>        at
> System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
> outerConnection, DbConnectionFactory connectionFactory)
>        at System.Data.OracleClient.OracleConnection.Open()
>        at Cambrex.ReportRoutines.GetParameterValue(String sConnection,
> String sCompanyCode, String sName, String sDatabase)
>        at ReportExprHostImpl.textbox22_TextBoxExprHost.get_ValueExpr()
>        at
> Microsoft.ReportingServices.ReportProcessing.ReportRuntime.EvaluateTextBoxValueExpression(TextBox
> textBox)
>
> Which has kind of thrown me.  My assembly I wrote is Strong Named and in the
> GAC.  When I check the zone of the exception it is MyComputer which has Full
> Trust so I am not too sure whats causing the problem.
>
> Any ideas?
>
> Thanks,
>
> Craig
>
>
>
Author
16 Feb 2006 9:43 PM
Craig
Thanks for the response.

The problem was not to do with the connection but the trust level of the
assembly.

I had to add a CodeGroup element to the RSPreviewPolicy.config of SSRS.
This allowed my assembly to receive trust and could then execute the Oracle
command.

Thanks,

Craig

Show quoteHide quote
"Narendra" <Naren***@discussions.microsoft.com> wrote in message
news:573AB624-D6FA-4301-A636-97BE947D8758@microsoft.com...
> Hi,
>  I think it is case of proper authentication/authorization configuration.
> I
> have not worked iwth oracle but following Couple of questions would help
> you
> to understand
> 1. How do you make database connection? (e.g windows authentication/ SQL
> authentication in MS-SQL)
> 2. Do you use any user name for database connection? if yes, please check,
> it has been granted an access.
>
> or you can send code where you are gettting an error.......
> regards,
> narendra.
>
> "Craig" wrote:
>
>> I have an assembly that I wrote in .NET 2.0 for Reporting Services.
>>
>> It essentially attaches to an Oracle DB and gets back a dataset.
>>
>> I tried it out by a test windows application and it worked fine, however
>> when I try and run it within Reporting Services I get...
>>
>> System.Security.SecurityException was unhandled by user code
>>   Message="Request for the permission of type
>> 'System.Data.OracleClient.OraclePermission, System.Data.OracleClient,
>> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
>> failed."
>>   Source="mscorlib"
>>   StackTrace:
>>        at System.Security.CodeAccessSecurityEngine.Check(Object demand,
>> StackCrawlMark& stackMark, Boolean isPermSet)
>>        at System.Security.PermissionSet.Demand()
>>        at System.Data.Common.DbConnectionOptions.DemandPermission()
>>        at System.Data.OracleClient.OracleConnection.PermissionDemand()
>>        at
>> System.Data.OracleClient.OracleConnectionFactory.PermissionDemand(DbConnection
>> outerConnection)
>>        at
>> System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
>> outerConnection, DbConnectionFactory connectionFactory)
>>        at System.Data.OracleClient.OracleConnection.Open()
>>        at Cambrex.ReportRoutines.GetParameterValue(String sConnection,
>> String sCompanyCode, String sName, String sDatabase)
>>        at ReportExprHostImpl.textbox22_TextBoxExprHost.get_ValueExpr()
>>        at
>> Microsoft.ReportingServices.ReportProcessing.ReportRuntime.EvaluateTextBoxValueExpression(TextBox
>> textBox)
>>
>> Which has kind of thrown me.  My assembly I wrote is Strong Named and in
>> the
>> GAC.  When I check the zone of the exception it is MyComputer which has
>> Full
>> Trust so I am not too sure whats causing the problem.
>>
>> Any ideas?
>>
>> Thanks,
>>
>> Craig
>>
>>
>>
Author
17 Feb 2006 12:13 AM
Craig
Oh one other thing.  I also had to Assert the OraclePermission object as
well before I called the open command.

Craig

Show quoteHide quote
"Craig" <craigm_richard***@hotmail.com> wrote in message
news:uMNABI0MGHA.2528@TK2MSFTNGP12.phx.gbl...
> Thanks for the response.
>
> The problem was not to do with the connection but the trust level of the
> assembly.
>
> I had to add a CodeGroup element to the RSPreviewPolicy.config of SSRS.
> This allowed my assembly to receive trust and could then execute the
> Oracle command.
>
> Thanks,
>
> Craig
>
> "Narendra" <Naren***@discussions.microsoft.com> wrote in message
> news:573AB624-D6FA-4301-A636-97BE947D8758@microsoft.com...
>> Hi,
>>  I think it is case of proper authentication/authorization configuration.
>> I
>> have not worked iwth oracle but following Couple of questions would help
>> you
>> to understand
>> 1. How do you make database connection? (e.g windows authentication/ SQL
>> authentication in MS-SQL)
>> 2. Do you use any user name for database connection? if yes, please
>> check,
>> it has been granted an access.
>>
>> or you can send code where you are gettting an error.......
>> regards,
>> narendra.
>>
>> "Craig" wrote:
>>
>>> I have an assembly that I wrote in .NET 2.0 for Reporting Services.
>>>
>>> It essentially attaches to an Oracle DB and gets back a dataset.
>>>
>>> I tried it out by a test windows application and it worked fine, however
>>> when I try and run it within Reporting Services I get...
>>>
>>> System.Security.SecurityException was unhandled by user code
>>>   Message="Request for the permission of type
>>> 'System.Data.OracleClient.OraclePermission, System.Data.OracleClient,
>>> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
>>> failed."
>>>   Source="mscorlib"
>>>   StackTrace:
>>>        at System.Security.CodeAccessSecurityEngine.Check(Object demand,
>>> StackCrawlMark& stackMark, Boolean isPermSet)
>>>        at System.Security.PermissionSet.Demand()
>>>        at System.Data.Common.DbConnectionOptions.DemandPermission()
>>>        at System.Data.OracleClient.OracleConnection.PermissionDemand()
>>>        at
>>> System.Data.OracleClient.OracleConnectionFactory.PermissionDemand(DbConnection
>>> outerConnection)
>>>        at
>>> System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
>>> outerConnection, DbConnectionFactory connectionFactory)
>>>        at System.Data.OracleClient.OracleConnection.Open()
>>>        at Cambrex.ReportRoutines.GetParameterValue(String sConnection,
>>> String sCompanyCode, String sName, String sDatabase)
>>>        at ReportExprHostImpl.textbox22_TextBoxExprHost.get_ValueExpr()
>>>        at
>>> Microsoft.ReportingServices.ReportProcessing.ReportRuntime.EvaluateTextBoxValueExpression(TextBox
>>> textBox)
>>>
>>> Which has kind of thrown me.  My assembly I wrote is Strong Named and in
>>> the
>>> GAC.  When I check the zone of the exception it is MyComputer which has
>>> Full
>>> Trust so I am not too sure whats causing the problem.
>>>
>>> Any ideas?
>>>
>>> Thanks,
>>>
>>> Craig
>>>
>>>
>>>
>
>