Skip to content

Commit 49affb7

Browse files
update
1 parent 9ef3b31 commit 49affb7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

articles/azure-app-configuration/enable-dynamic-configuration-dotnet-background-service.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ You use the [.NET command-line interface (CLI)](/dotnet/core/tools/) to create a
7373
1. Connect to App Configuration.
7474
7575
```csharp
76+
// Existing code in Program.cs
77+
// ... ...
78+
79+
var builder = Host.CreateApplicationBuilder(args);
80+
7681
builder.Configuration.AddAzureAppConfiguration(options =>
7782
{
7883
options.Connect(Environment.GetEnvironmentVariable("ConnectionString"))
@@ -88,7 +93,8 @@ You use the [.NET command-line interface (CLI)](/dotnet/core/tools/) to create a
8893
builder.Services.AddSingleton(options.GetRefresher());
8994
});
9095
91-
builder.Services.AddFeatureManagement();
96+
// The rest of existing code in Program.cs
97+
// ... ...
9298
```
9399
94100
In the `ConfigureRefresh` method, a key within your App Configuration store is registered for change monitoring. The `Register` method has an optional boolean parameter `refreshAll` that can be used to indicate whether all configuration values should be refreshed if the registered key changes. In this example, only the key *TestApp:Settings:Message* will be refreshed. All settings registered for refresh have a default cache expiration of 30 seconds before a new refresh is attempted. It can be updated by calling the `AzureAppConfigurationRefreshOptions.SetCacheExpiration` method.
@@ -120,6 +126,7 @@ You use the [.NET command-line interface (CLI)](/dotnet/core/tools/) to create a
120126
{
121127
_logger.LogInformation(_configuration["TestApp:Settings:Message"] ?? "No data.");
122128
}
129+
123130
await Task.Delay(TimeSpan.FromSeconds(30), stoppingToken);
124131
}
125132
}

0 commit comments

Comments
 (0)