Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            var pathBase = Configuration["API_PATH_BASE"];

            if (!string.IsNullOrWhiteSpace(pathBase))
            {
                app.UsePathBase($"/{pathBase.TrimStart('/')}");
            }

            app.UseDeveloperExceptionPage();

            AppConfigUtilities._configuration = Configuration;



            AutofacContainer        = app.ApplicationServices.GetAutofacRoot();
            DomainEvents._Container = AutofacContainer.BeginLifetimeScope();

            //  DependencyConfig.RegisterEvent();
            app.UseHttpsRedirection();
            app.UseRouting();

            app.UseAuthentication();
            app.UseSwagger(c => Swagger.Use(Configuration, c));
            app.UseSwaggerUI(c => Swagger.UseSwaggerUI(c, env, "User"));

            app.UseMiddleware <BasicAuthMiddleware>();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }