I need to set the environment variable COMPLUS_FORCEENC=1
in an ASP.NET application. This variable must be set at the time the worker process starts to have an effect.
Therefore, I did this:
- Create a new user using the Computer Management console.
- Set a password.
- Make sure it is a member of
Users
andIIS_IUSRS
. - Configure the IIS Application Pool to use that user and load the user profile. This is using a custom pool, not the default one.
- Log in as that user to set the variable.
- Relogin to make sure the variable is set.
- Restart the OS.
- Make sure the application loads and works.
Unfortunately, the ASP.NET app does not see the variable. I printed the whole environment from within the app.
When I use Process Explorer on the worker process I see that it runs under the correct user but the variable is not set. Also, the TEMP
variable points to C:\Windows\Temp
and not (as expected) to the user profile's temp directory (which exists). I understand this is a sign of the user profile not being loaded.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist
shows the hive of that user loaded. The Environment
key for that user appears to be populated correctly:
What did I do wrong? How can I make the variable appear?
This is a Windows 7 machine.