public void ConfigureContainer(ServiceRegistry services) { services.AddLogging(config => { config.ClearProviders(); config.AddConfiguration(Configuration.GetSection("Logging")); config.AddApplicationInsights(); }); //Response Compression - https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-5.0 services.AddResponseCompression(); services.AddCors(options => { options.AddPolicy("SpecificOrigins", builder => { builder.WithOrigins("https://tmireact.azurewebsites.net", "https://theminiindex.com", "https://wwww.theminiindex.com", "http://localhost:3000") .AllowAnyHeader() .AllowAnyMethod(); }); }); services.Configure <CookiePolicyOptions>(options => { options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddSwaggerGen(); services.AddDefaultIdentity <IdentityUser>() .AddRoles <IdentityRole>() .AddEntityFrameworkStores <MiniIndexContext>(); services.AddHangfire(configuration => configuration .SetDataCompatibilityLevel(CompatibilityLevel.Version_170) .UseSimpleAssemblyNameTypeSerializer() .UseRecommendedSerializerSettings() .UseSqlServerStorage(Configuration.GetConnectionString("HangfireConnection"), new SqlServerStorageOptions { CommandBatchMaxTimeout = TimeSpan.FromMinutes(5), SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), QueuePollInterval = TimeSpan.Zero, UseRecommendedIsolationLevel = true, DisableGlobalLocks = true })); services.AddHangfireServer(); services .AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_3_0) .AddRazorOptions(ConfigureRazor); services.AddDbContext <MiniIndexContext>(ConfigureEntityFramework); string facebookAppId = Configuration["Authentication:Facebook:AppId"]; string facebookAppSecret = Configuration["Authentication:Facebook:AppSecret"]; if (facebookAppId != null && facebookAppSecret != null) { services.AddAuthentication() .AddFacebook(facebookOptions => { facebookOptions.AppId = facebookAppId; facebookOptions.AppSecret = facebookAppSecret; }); } services.AddTransient <IEmailSender, EmailSender>(); services.Configure <AuthMessageSenderOptions>(Configuration); services.AddApplicationInsightsTelemetry(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddSingleton <ITelemetryInitializer, TelemetryEnrichment>(); services.AddApplicationInsightsTelemetryProcessor <AppInsightsFilter>(); services.Configure <AzureStorageConfig>(Configuration.GetSection("AzureStorageConfig")); services.IncludeRegistry <CoreServices>(); services.IncludeRegistry <WebAppServices>(); }