Working with Oracle in .NET environment
While working with oracle in .NET projects I came across one very annoying reoccurring problem:
"Could not create an environment: OCIEnvCreate returned -1"
Two things came up:
1 - permissions issue
2 - a missing ORACLE_HOME environment variable
"Ever received this error message while trying to connect to a Oracle database from .Net and wondered why this is happening. Well, I was banging my head on my workstation for about a week.
The whole internet pointed to the oracle bin folder not having permissions to ASPNET account. I gave full access for all the folders to Everyone in this world in addition to ASPNET account. ( I guess only Read & Execute and List folder contents permissions are enough). Still, my ASP.Net application was not connecting to the database.
So, what was the problem ???
My machine did not have a ORACLE_HOME environment variable. There was a Oracle forms installation and I guess my application was trying to create the environment inside the Oracle forms folder.
I created a ORACLE_HOME environment variable pointing to the Oracle directory. Restarted the machine. Bingo! it started working."
Source -> here