ASP.Net Core 2.2 web app being published to a dev/test server. In my publish profile, I have this
<PropertyGroup>
<EnvironmentName>Test</EnvironmentName>
</PropertyGroup>
When I publish to the destination, I look at the web.config file, I see the correct environment setting.
name="ASPNETCORE_ENVIRONMENT" value="Test"
However, when I hit the website in a browser, I get the error suggesting that the environment var is set to Development ?
Error. An error occurred while processing your request.
Request ID: 0HLLKB82R933P:00000002 Development Mode
Swapping to the Development environment displays detailed information about the error that occurred.
The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.
[ update ]
If I changed the ASPNETCORE_ENVIRONMENT value to "Test" in the project settings, before publishing, the app works as expected. As another commenter before has suggested, this might be something that only works as expected for "in-process" apps. So Im looking at that next.
--environment
) or just set an environment variable manually on the system. – Chris Pratt