I am developing an ASP.NET Core API (.NET Core 3.1). Everything works as expected. When I deploy the application on the consumer environment using Octopus, it reads the appsettings.Production.json
, not the appsettings.Uat.json
even if I have set the ASPNETCORE_ENVIRONMENT
to Consumer.
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Mydll.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
launchsettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50900",
"sslPort": 0
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "default",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS_UAT Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "default",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Consumer"
}
},
"IIS_PRODUCTION Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "default",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
},
"ISOXMLValidationApi": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "default",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
Octopus variables: