@@ -76,46 +76,46 @@ dotnet new mvc --no-https --output TestAppConfig
76
76
#### [.NET 6.x](#tab/core6x)
77
77
In *Program.cs*, and replace its content with the following code:
78
78
79
- ```csharp
80
- var builder = WebApplication.CreateBuilder(args);
81
- builder.Host.ConfigureAppConfiguration(builder =>
82
- {
83
- builder.AddAzureAppConfiguration(options =>
84
- {
85
- //Connect to your App Config Store using a connection string
86
- options.Connect(Environment.GetEnvironmentVariable("AppConfig"))
87
- // Load all keys that start with `TestApp:` and have no label
88
- .Select("TestApp:*");
89
- });
90
- })
91
- .ConfigureServices(services =>
79
+ ```csharp
80
+ var builder = WebApplication.CreateBuilder(args);
81
+ builder.Host.ConfigureAppConfiguration(builder =>
82
+ {
83
+ builder.AddAzureAppConfiguration(options =>
92
84
{
93
- // Make Azure App Configuration services available through dependency injection
94
- services.AddAzureAppConfiguration()
95
- .AddControllersWithViews();
85
+ //Connect to your App Config Store using a connection string
86
+ options.Connect(Environment.GetEnvironmentVariable("AppConfig"))
87
+ // Load all keys that start with `TestApp:` and have no label
88
+ .Select("TestApp:*");
96
89
});
97
-
98
- var app = builder.Build();
99
-
100
- // Configure the HTTP request pipeline.
101
- if (!app.Environment.IsDevelopment())
90
+ })
91
+ .ConfigureServices(services =>
102
92
{
103
- app.UseExceptionHandler("/Home/Error");
104
- }
105
- app.UseStaticFiles();
106
-
107
- app.UseAzureAppConfiguration();
108
-
109
- app.UseRouting();
110
-
111
- app.UseAuthorization();
112
-
113
- app.MapControllerRoute(
114
- name: "default",
115
- pattern: "{controller=Home}/{action=Index}/{id?}");
116
-
117
- app.Run();
118
- ```
93
+ // Make Azure App Configuration services available through dependency injection
94
+ services.AddAzureAppConfiguration()
95
+ .AddControllersWithViews();
96
+ });
97
+
98
+ var app = builder.Build();
99
+
100
+ // Configure the HTTP request pipeline.
101
+ if (!app.Environment.IsDevelopment())
102
+ {
103
+ app.UseExceptionHandler("/Home/Error");
104
+ }
105
+ app.UseStaticFiles();
106
+
107
+ app.UseAzureAppConfiguration();
108
+
109
+ app.UseRouting();
110
+
111
+ app.UseAuthorization();
112
+
113
+ app.MapControllerRoute(
114
+ name: "default",
115
+ pattern: "{controller=Home}/{action=Index}/{id?}");
116
+
117
+ app.Run();
118
+ ```
119
119
120
120
This code will connect to your App Configuration Store using a connection string and load all keys that have the *TestApp* prefix from a previous step.
121
121
0 commit comments