Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services
            .AddMvc(options =>
            {
                options.ReturnHttpNotAcceptable = false;       // remove this in the furute
            })
            .AddJsonOptions(options =>
            {
                options.SerializerSettings.ContractResolver = new DefaultContractResolver();
            });

            ServicesConfig.ConfigureServices(services, Configuration);

            return(AutofacRegistrations.ConfigureServices(services, Configuration));
        }
Ejemplo n.º 2
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)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMiddleware(
                typeof(Utils.AspNetCore.ErrorHandlingMiddleware),
                loggerFactory,
                typeof(Sembium.ContentStorage.Misc.Utils.UserException),
                typeof(Sembium.ContentStorage.Misc.Utils.UserAuthenticationException),
                typeof(Sembium.ContentStorage.Misc.Utils.UserAuthorizationException)
                );

            app.UseMvc();

            ServicesConfig.Configure(loggerFactory, Configuration);
        }