We're having an issue right now where we're unable to debug our Dev server environment:
Now, I've spent literal hours searching for how to set ASPNETCORE_ENVIRONMENT and I've only found two (practical) ways:
- Create a web.[MYCONFIGURATION].config file and add in the following, where [MYCONFIGURATION] would be something like Development or Release:
web.[MYCONFIGURATION].config:
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
- Set IIS variables on the deployed server to enable ASPCORE_ENVIRONMENT
Here are the problems with each:
- Since .NET Core uses appsettings.json files for its configuration (a web.config is generated from it, so far as I understand), things like our database connection strings and other settings get lost if we create a web.config ourselves.
- We are running in an enterprise-level, multi-application environment with a combination of .NET Core and non-Core ASP.NET applications (which I do not have access to), so changing IIS's settings for our application only is not an option.
It should be noted that we are using TFS's Build/Release to publish to our Dev server. I had hoped that adding a BuildConfiguration variable of "development" would also work to set ASPNETCORE_ENVIRONMENT, but unfortunately it does not.
What can I do to set ASPNETCORE_ENVIRONMENT for our application only without needing a web.config or IIS settings? Or, if that is presently impossible, how can I make one of the two options work, given the constraints I have described?