C# AWS Parameter Store - Configuration not loading SystemManagerConfiguration in .Net 6

Viewed 425

Application is not able to talk to AWS Parameter Store in .NET 6. It is always talking to appsettings.json.

I tried debugging locally, still same behavior. Not able to find the SystemManagerConfiguration under list of configuration .

enter image description here

var builder = WebApplication.CreateBuilder();
var connectionString = builder.Configuration.GetConnectionString("OrderTrackerDatabase");

enter image description here

Packages Used

enter image description here

Library Source Code : https://github.com/aws/aws-dotnet-extensions-configuration

image

3 Answers

I got the same issue and finally resolved it. The samples code in https://github.com/aws/aws-dotnet-extensions-configuration missed one line as below after called "AddSystemsManager" method in .Net 6.

builder.Services.Configure<Settings>(builder.Configuration.GetSection($"common:settings"));

After added above line, then I'm able to get the correct values from AWS Parameter Store when using the settings.

I've also created an issue of this in GitHub as below - https://github.com/aws/aws-dotnet-extensions-configuration/issues/114

I believe the problem might be the trailing slash after "/OrderTracking/", try "/OrderTracking" instead.

WebApplication.CreateBuilder() will create new instance and doesn't carry over the SystemManager configuration.

Instead, use IConfiguration instance through constructor DI.

 var connectionString = _configuration.GetConnectionString("OrderTrackerDatabase");
Related