Exemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseAbp();

            app.UseAuthentication();

            if (env.IsDevelopment())
            {
                ExceptionHandlerConfigurer.UseDev(app);
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            app.UseStaticFiles();
            app.UseRouting();

            app.UseAuthentication();

            app.UseJwtTokenMiddleware();

            app.UseAuthorization();

            //CookieConfigurer.Use(app);
            CorsConfigurer.Use(app);
            MvcConfigurer.Use(app);
            SwagConfigurer.Use(app);
        }
Exemplo n.º 2
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddAbpDbContext <BackendDbContext>(options =>
            {
                DbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
            });
            CorsConfigurer.Configure(services);
            AuthConfigurer.Configure(services, _appConfiguration);
            MvcConfigurer.Configure(services);
            SwagConfigurer.Configure(services);
            //CookieConfigurer.Configure(services);

            services.AddControllersWithViews(options =>
            {
                //options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
            }).AddNewtonsoftJson();

            return(services.AddAbp <BackendWebModule>(options =>
            {
                options.IocManager.IocContainer.AddFacility <LoggingFacility>(
                    f => f.UseAbpLog4Net().WithConfig("log4net.config")
                    );
            }));
        }