These are thus far, the most annoying messages i encountered within the week.
The type initializer for ‘Oracle.DataAccess.Client.OracleConnection‘ threw an exception
System.Data.OracleClient requires Oracle client software version 8.1.7 or greater
and the error that causes this could be anything.
I’m not gonna go through the possibilities one by one, but here are a list of what you can check out. You’re probably already sure that you have the right client (needless to say, the right version as well) so we’ll get that out of the way.
- Access to the Oracle Installation Folder Give Authenticated Users access. Restart if you can.
- Get the right DLL How many versions of System.Data.OracleClient and Oracle.DataAccess do you have? Have you checked the GAC as well? This is not the best approach, but to make your life a little easier, use a File Reference for your libraries, rather than a GAC reference
- Impersonate If you’re running it on WCF you need to add this attribute wherever your data access may be. Either in your SVC or in yet another class library
<OperationBehavior(Impersonation = ImpersonationOption.Required)>
- Check your ports If you’re hosting on IIS, make sure you don’t have 2 ports having the same name. The WCF Service itself will work just fine. The SQL Server access in your Service, if any, will also work just fine.