Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IUserRepository <string> userRepository, IOptions <ClientRateLimitPolicies> clientRateLimitPolicies)
        {
            // will load user rate limit in memory cache
            RateLimitHelper.LoadUsersRateLimits(userRepository, clientRateLimitPolicies);

            //app.UseClientRateLimiting();
            app.UseMiddleware <CustomClientRateLimit>();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }

            app.UseStatusCodePages();

            app.UseStaticFiles();

            // Config Auto Mapper
            AutoMapperConfig.Setup();

            // Seed Database with initial data
            // SeedDBHelper.EnsureDBSeeded(logSystemUnitOfWork, settings);


            // setup swagger ui
            SwaggerConfig.Config(app);

            app.UseMvc();
        }