OracleProfileProvider Cannot perform CAS Asserts in Security Transparent methods

OracleProfileProvider Cannot perform CAS Asserts in Security Transparent methods

Postby fda » Tue 28 Oct 2014 14:45

Hello,

I have a web application using Devart.Connect for Oracle.

I received the following error when I tried to launch the web service:
****************************************************************************

Server Error in '/WindowsClient' Application.

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Exception has been thrown by the target of an invocation.

Source Error:

Line 92: add name="DevartOracleProfileProvider" type="Devart.Data.Oracle.Web.Providers.OracleProfileProvider, Devart.Data.Oracle.Web , Version=8.4.225.4, Culture=neutral, PublicKeyToken=09af7300eec23701" connectionStringName="DefaultConnection" applicationName="/"/

********************************************************************************
Also in the log file is the following error:
[2014-10-28T15:30:47.3105341+01:00] [ERROR] [1 ] [Tgw.Windows.Web.MvcApplication] Unhandled application error occured. Sender: [ASP.global_asax]. Info: System.ApplicationException: Could not load application configuration. ---> System.Configuration.ConfigurationErrorsException: Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Cannot perform CAS Asserts in Security Transparent methods
at Devart.Common.Web.Providers.DbProfileProvider..ctor(String defaultName, String defaultDescription, DbProviderFactory provider)

**************************************************

In the web.config, I have the following configuration:

<add name="DevartOracleProfileProvider" type="Devart.Data.Oracle.Web.Providers.OracleProfileProvider, Devart.Data.Oracle.Web , Version=8.4.225.4, Culture=neutral, PublicKeyToken=09af7300eec23701"
connectionStringName="DefaultConnection" applicationName="/"/>

and

<system.data>
<DbProviderFactories>
<remove invariant="Devart.Data.Oracle" />
<add name="dotConnect for Oracle" invariant="Devart.Data.Oracle" description="Devart dotConnect for Oracle" type="Devart.Data.Oracle.OracleProviderFactory, Devart.Data.Oracle, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
</system.data>

I use Devart.Data.Oracle.Web version 8.4.224.4

Any help with this?


Thanks
fda
 
Posts: 1
Joined: Tue 28 Oct 2014 14:30

Re: OracleProfileProvider Cannot perform CAS Asserts in Security Transparent methods

Postby Pinturiccio » Fri 31 Oct 2014 09:21

The following permissions are required by dotConnect for Oracle in a partially trusted environment:
I. Direct mode - medium trust plus SocketPermission.
For more information, please refer to http://www.devart.com/dotconnect/oracle/docs/deployment.html

So, you should do the following:
1) Open the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config folder (the 'v4.0.30319' folder should correspond to the Framework version, in which the application is executed);
2) Open the web_mediumtrust.config file;
3) Add the following record to the <SecurityClasses> section:
Code: Select all
<SecurityClass Name="SocketPermission" Description="System.Net.SocketPermission, System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

4) Add the following record to the <NamedPermissionSets> section:
Code: Select all
<IPermission
   class="SocketPermission"
        version="1"
        Unrestricted="true"
/>


II. OCI mode - medium trust plus ReflectionPermission, RegistryPermission, EnvironmentPermission for PATH environment variable, FileIOPermission for Oracle Client.

So, you should do the following:
1) Open the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config folder (the 'v4.0.30319' folder should correspond to the Framework version, in which the application is executed);
2) Open the web_mediumtrust.config file;
3) Add the following record to the <SecurityClasses> section:
Code: Select all
<SecurityClass Name="ReflectionPermission" Description="System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="RegistryPermission" Description="System.Security.Permissions.RegistryPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="EnvironmentPermission" Description="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
yClass Name="FileIOPermission" Description="System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

4) Add the following record to the <NamedPermissionSets> section:
Code: Select all
<IPermission
   class="ReflectionPermission"
        version="1"
        Unrestricted="true"
/>
<IPermission
   class="RegistryPermission"
        version="1"
        Unrestricted="true"
/>
<IPermission
   class="EnvironmentPermission"
        version="1"
        Read="PATH"
/>
<IPermission
   class="FileIOPermission"
        version="1"
        Read="Oracle Client location folder"
        Write="Oracle Client location folder"
        Append="Oracle Client location folder"
        PathDiscovery="Oracle Client location folder"
/>
Pinturiccio
Devart Team
 
Posts: 2024
Joined: Wed 02 Nov 2011 09:44


Return to dotConnect for Oracle