// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); //services.AddDbContext<ApplicationDbContext>(options => // options.UseInMemoryDatabase("InMemeory")); services.AddDefaultIdentity <ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores <ApplicationDbContext>(); services.AddIdentityServer() .AddApiAuthorization <ApplicationUser, ApplicationDbContext>(); services.AddAuthentication() .AddIdentityServerJwt(); services.AddSignalR(); services.AddControllersWithViews(); services.AddRazorPages(); // In production, the Angular files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/dist"; }); services.AddHttpContextAccessor(); services.AddScoped <IIdentityProvider, IdentityProvider>(); var appplicationDefaultConfigs = new ApplicationDefaultConfig(); Configuration.Bind(ApplicationDefaultConfig.ApplicationDefaultConfigKey, appplicationDefaultConfigs); services.AddSingleton(appplicationDefaultConfigs); WebApplicationContext.Build(services, x => { x.RegisterSingleton <IMessageHandler <string>, NewConnectorRequestMessageHandler>(); x.RegisterSingleton <IRequestsDictionaryAccesor, RequestsDictionaryAccesor>(); x.RegisterSingleton <IRequestOrchestrator, RequestOrchestrator>(); x.RegisterSingleton <Web.Core.ExternalyImplementedServices.IConfigurationProvider, ConfigProvider>(); x.RegisterType <IContextProvider, ContextProvider>(); x.RegisterType <ICurrentTunnelsAccesor, CurrentTunnelsAccesor>(); }); services.AddHostedService <QueueConsumerBackgroundService>(); }