Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
System Environment Variables not being read on server #1864
I have an asp.net core website which works fine locally. I use environment variables to store the Environment and a couple of connection strings. Not a problem locally. When i deploy the website to the server (via release manager, xcopy and powershell scripts running as an administrator) the appropriate variables are created/updated on that server. I have confirmed that they are there.
I start the website and I get the following returned in the log:
So it is starting, but the environment is being reported as Production. Don't know where that is coming from because the ASPNETCORE_Environment=DEV. I don't use the term "Production" anywhere in my code, I have dbl-checked. We use the term "PRD". I even updated the default template code to use UAT,PRD instead of Staging, Production in all the places it appears (_Layout.cshtml, etc).
I have raised a stackoverflow question outlining in more detail the issue.
I appears that the system environment variables are being completely ignored. I thought initially that it may be a permission issue, but I changed the Application Pool in IIS to run as me, but still not.
Can anyone point me in a direction to look for the issue? Or that I can respond to to further clarify the setup.
I just noticed that the ApplicationPool instance had LoadUserProfile =false, setting it to true made the site work as expected and the variables were loaded. Now to change the deployment script that creates the apppool to ensure that value is set to true.
I was a little surprised I had to load the user profile for machine variables.
Thanks for the help.