My Oracle Support Banner

ODP.NET Web Application Fails While Configure Medium/High Trust Levels in IIS (Doc ID 1967542.1)

Last updated on NOVEMBER 19, 2019

Applies to:

Oracle Data Provider for .NET - Version and later
Microsoft Windows x64 (64-bit) - Version: 2008 R2


Oracle Client : (With Custom Installation)

Web server using ODP.NET to connect the Oracle Database . Application works fine while running IIS .NET trust level  equals to Low/Minimal . But when we change .NET trust level equals Medium/High it fails with below errors.

Application ID:
Process ID: 4852
Exception: System.TypeInitializationException
Message: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.
StackTrace: at Oracle.DataAccess.Client.OracleConnection.Dispose(Boolean disposing)
at System.ComponentModel.Component.Finalize()
InnerException: System.Security.SecurityException
Message: System.Security.Permissions.SecurityPermission
StackTrace: at Oracle.DataAccess.Client.OracleConnection..cctor()

There are 2 ways to Change Trust Levels

  1. Changing your trust level through IIS Manager.
  2. Using  web.config file

Add the following line between the <system.web> and </system.web> elements:

<trust level=" Medium” /> (replace “Medium “with your preferred trust level).


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.