My code is exactly the same as the code presented in this StackOverflow question(but fixed). The code runs fine in a standalone Web API project but when I add the same ASP.NET Core Web API project in a Service Fabric project template and run it on local cluster, _mySettings
is always null. Is there something that I am missing here? I am using Options<type>
approach. I can confirm that the Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")
evaluates to "Development", in my HomeController
code.
The project targets .NET Core 3.1.