I need to run some web sites 64-bit and one as 32-bit on the same server. I set up different app pools for each site, with all running as ApplicationPoolIdentity. The reason for the bitness is that the 64-bit sites need to use a 64-bit Oracle Client and the 32-bit site needs a 32-bit Oracle client. To change clients I need only change two environment variables. So I defaulted the machine to 64-bit so I only need to change two environment variables to get the one 32-bit application pool to work.
But I can't change the environment variables for the 32-bit application pool. I want to use ApplicationPoolIdentity but nothing I try works. I try the registry, but that does not work. It seems that ApplicationPool identies, not being real, don't read env variables from registry. They all clone a common identity (network service I think.) I even changed the code to set the environment variable in the APPLICATION_START event of asp.net, but that still does not seem to work. My guess is that the oracle client code is running a different thread and so it does not see the environment variable.
How can I configure the application pool to have a different environment while still using ApplicationPoolIdentity? It would seem useful to have different environments for different application pools, but it just won't do it. I have tried load userprofile on or off and it seemed to make no difference. No matter what it is reading the machine level environment variables. Even have the code save the environment variables to user does not work, but this may be a permission thing. But if code running as the ApplicationPoolIdentity cannot change the environment variables, how can it be done?