diff --git a/examples/ConfigStoreDemo/Program.cs b/examples/ConfigStoreDemo/Program.cs index 40d0b9ed..2614c746 100644 --- a/examples/ConfigStoreDemo/Program.cs +++ b/examples/ConfigStoreDemo/Program.cs @@ -24,6 +24,14 @@ public static IWebHost BuildWebHost(string[] args) // 3. Set up the provider to listen for changes to the background color key-value in Azure App Configuration var settings = config.AddJsonFile("appsettings.json").Build(); + + if (string.IsNullOrEmpty(settings["connection_string"])) + { + throw new InvalidOperationException( + "Connection string not found. " + + "Please set the 'connection_string' in appsettings.json."); + } + config.AddAzureAppConfiguration(options => { options.Connect(settings["connection_string"]) diff --git a/examples/ConsoleAppWithFailOver/Program.cs b/examples/ConsoleAppWithFailOver/Program.cs index decbba29..dd89670d 100644 --- a/examples/ConsoleAppWithFailOver/Program.cs +++ b/examples/ConsoleAppWithFailOver/Program.cs @@ -31,7 +31,10 @@ private static void Configure() IConfiguration configuration = builder.Build(); IConfigurationSection endpointsSection = configuration.GetSection("AppConfig:Endpoints"); - IEnumerable endpoints = endpointsSection.GetChildren().Select(endpoint => new Uri(endpoint.Value)); + IEnumerable endpoints = endpointsSection.GetChildren() + .Select(endpoint => endpoint.Value) + .Where(value => !string.IsNullOrEmpty(value)) + .Select(value => new Uri(value)); if (endpoints == null || !endpoints.Any()) {