diff --git a/Childrens-Social-Care-CPD/Program.cs b/Childrens-Social-Care-CPD/Program.cs index 9c393073..91b80fc9 100644 --- a/Childrens-Social-Care-CPD/Program.cs +++ b/Childrens-Social-Care-CPD/Program.cs @@ -11,7 +11,7 @@ builder.AddDependencies(); Console.WriteLine($"After AddDependencies {sw.ElapsedMilliseconds}ms"); -await builder.AddFeatures(sw); +builder.AddFeatures(sw); Console.WriteLine($"After AddFeatures {sw.ElapsedMilliseconds}ms"); var app = builder.Build(); diff --git a/Childrens-Social-Care-CPD/WebApplicationBuilderExtensions.cs b/Childrens-Social-Care-CPD/WebApplicationBuilderExtensions.cs index b4157547..e0001126 100644 --- a/Childrens-Social-Care-CPD/WebApplicationBuilderExtensions.cs +++ b/Childrens-Social-Care-CPD/WebApplicationBuilderExtensions.cs @@ -95,7 +95,7 @@ private static void AddSearch(IServiceCollection services) services.AddScoped(); } - public static async Task AddFeatures(this WebApplicationBuilder builder, Stopwatch sw) + public static void AddFeatures(this WebApplicationBuilder builder, Stopwatch sw) { ArgumentNullException.ThrowIfNull(builder); @@ -123,7 +123,7 @@ public static async Task AddFeatures(this WebApplicationBuilder builder, Stopwat AddHealthChecks(builder.Services); Console.WriteLine($"After AddHealthChecks: {sw.ElapsedMilliseconds}ms"); - await AddDataProtection(builder.Services, applicationConfiguration, sw); + AddDataProtection(builder.Services, applicationConfiguration, sw); Console.WriteLine($"After AddDataProtection: {sw.ElapsedMilliseconds}ms"); } @@ -176,7 +176,7 @@ private static void AddHealthChecks(IServiceCollection services) #pragma warning restore CA1861 // Avoid constant arrays as arguments } - private static async Task AddDataProtection(IServiceCollection services, ApplicationConfiguration applicationConfiguration, Stopwatch sw) + private static void AddDataProtection(IServiceCollection services, ApplicationConfiguration applicationConfiguration, Stopwatch sw) { if (!string.IsNullOrEmpty(applicationConfiguration.AzureDataProtectionContainerName)) { @@ -187,11 +187,6 @@ private static async Task AddDataProtection(IServiceCollection services, Applica var managedIdentityCredential = new ManagedIdentityCredential(clientId: applicationConfiguration.AzureManagedIdentityId); Console.WriteLine($"After AddDataProtection:new ManagedIdentityCredential: {sw.ElapsedMilliseconds}ms"); - var blobContainerUri = new Uri(url); - var blobContainerClient = new BlobContainerClient(blobContainerUri, managedIdentityCredential); - await blobContainerClient.CreateIfNotExistsAsync(); - Console.WriteLine($"After AddDataProtection:blobContainerClient.CreateIfNotExistsAsync: {sw.ElapsedMilliseconds}ms"); - var blobUri = new Uri($"{url}/data-protection"); services .AddDataProtection()