4

I'm deploying a .NET Core application twice to the same server, once for QA, and once for Production. Currently I have each one of them using a different local user to run the IIS App Pool and have set the ASPNETCORE_ENVIRONMENT variables to "qa" and "production" accordingly.

This doesn't appear to work, both sites run the production configuration which I understand is the default.

Things I've looked at so far:

  1. I can log in as each of the users, and the variables are set correctly.
  2. There is no system level env var set, though the user level vars are supposed to override it if there was.
  3. I can see the processes running as the correct users in the task manager.
  4. I have restarted the entire system after setting the env vars

It just appears that .NET is ignoring the environment variable.

Has anyone else managed to get user level env vars working with a .NET core deployment?

Additional Info: I can set ASPNETCORE_ENVIRONMENT at the system level, and both sites pick it up and run with it. Doing it without a system variable simply doesn't work.

Brad Gardner
  • 1,627
  • 14
  • 14
  • What account is the site running as? Doing it as a user level variable does no good if you do it for the wrong user. – mason Jun 13 '17 at 02:29
  • Each app pool is running as it's respective user and I can verify them by seeing the proper user in the task manager for the worker process and the .net core executable. – Brad Gardner Jun 13 '17 at 03:05
  • Possible duplicate of [What exactly happens when I set LoadUserProfile of IIS pool?](https://stackoverflow.com/questions/17149132/what-exactly-happens-when-i-set-loaduserprofile-of-iis-pool) – Lex Li Jun 13 '17 at 03:52

1 Answers1

8

If you want to use user specific environment variables, then the application pool setting LoadUserProfile should be set to true (false is the default),

What exactly happens when I set LoadUserProfile of IIS pool?

Lex Li
  • 60,503
  • 9
  • 116
  • 147