public IServiceProvider ConfigureServices(IServiceCollection services) { // MVC services.AddControllersWithViews(options => { options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute()); }) #if DEBUG .AddRazorRuntimeCompilation() #endif .AddNewtonsoftJson(); if (bool.Parse(_appConfiguration["KestrelServer:IsEnabled"])) { ConfigureKestrel(services); } IdentityRegistrar.Register(services); //Identity server if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"])) { IdentityServerRegistrar.Register(services, _appConfiguration, options => options.UserInteraction = new UserInteractionOptions() { LoginUrl = "/Account/Login", LogoutUrl = "/Account/LogOut", ErrorUrl = "/Error" }); } AuthConfigurer.Configure(services, _appConfiguration); if (WebConsts.SwaggerUiEnabled) { //Swagger - Enable this line and the related lines in Configure method to enable swagger UI services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo() { Title = "LDI API", Version = "v1" }); options.DocInclusionPredicate((docName, description) => true); options.ParameterFilter <SwaggerEnumParameterFilter>(); options.SchemaFilter <SwaggerEnumSchemaFilter>(); options.OperationFilter <SwaggerOperationIdFilter>(); options.OperationFilter <SwaggerOperationFilter>(); options.CustomDefaultSchemaIdSelector(); }).AddSwaggerGenNewtonsoftSupport(); } //Recaptcha services.AddreCAPTCHAV3(x => { x.SiteKey = _appConfiguration["Recaptcha:SiteKey"]; x.SiteSecret = _appConfiguration["Recaptcha:SecretKey"]; }); if (WebConsts.HangfireDashboardEnabled) { //Hangfire (Enable to use Hangfire instead of default job manager) services.AddHangfire(config => { config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default")); }); } services.AddScoped <IWebResourceManager, WebResourceManager>(); services.AddSignalR(); if (WebConsts.GraphQL.Enabled) { services.AddAndConfigureGraphQL(); } services.Configure <SecurityStampValidatorOptions>(options => { options.ValidationInterval = TimeSpan.Zero; }); if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"])) { services.AddAbpZeroHealthCheck(); var healthCheckUISection = _appConfiguration.GetSection("HealthChecks")?.GetSection("HealthChecksUI"); if (bool.Parse(healthCheckUISection["HealthChecksUIEnabled"])) { services.Configure <HealthChecksUISettings>(settings => { healthCheckUISection.Bind(settings, c => c.BindNonPublicProperties = true); }); services.AddHealthChecksUI() .AddInMemoryStorage(); } } services.Configure <RazorViewEngineOptions>(options => { options.ViewLocationExpanders.Add(new RazorViewLocationExpander()); }); //Configure Abp and Dependency Injection return(services.AddAbp <LDIWebMvcModule>(options => { //Configure Log4Net logging options.IocManager.IocContainer.AddFacility <LoggingFacility>( f => f.UseAbpLog4Net().WithConfig(_hostingEnvironment.IsDevelopment() ? "log4net.config" : "log4net.Production.config") ); options.PlugInSources.AddFolder(Path.Combine(_hostingEnvironment.WebRootPath, "Plugins"), SearchOption.AllDirectories); })); }