Every time I call Configuration.GetSection
, the Value
property of the returned object is always null.
My Startup
constructor
var serviceProvider = services.BuildServiceProvider();
must come after all services.Configure
calls.
In my case for Web Api Core 2.1, I needed Program.cs
in the project root folder (the same folder as Startup.cs).
If all the other answers do not fix the problem, another reason could be that the properties of the Options class are private (or do not have accessible setters).