public ActionResult SelectLogLevel(LogLevelModel logLevelModel) { if (ModelState.IsValid) { logHandlerService.SetLogLevel(logLevelModel.LogLevel); } SetLogLevels(logLevelModel.LogLevel); return(View("Index", logLevelModel)); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //services.AddDbContext<AppDbContext>(options => // options.UseInMemoryDatabase("InMemoryDb")); //services.AddTransient<FactoryActivatedMiddleware>(); //var sectionExists = _config.GetSection("Logging:LogLevel").Exists(); var logLevelModel = new LogLevelModel(); Configuration.GetSection("Logging:LogLevel").Bind(logLevelModel); //services.AddScoped<ClientIpCheckFilter>(); ////Ìí¼Ó×Ô¶¨Ò建´æ //services.AddMemoryCustomizeCache(Configuration); //services.AddMvc(options => //{ // options.Filters.Add // (new ClientIpCheckPageFilter // (_loggerFactory, Configuration)); //}).SetCompatibilityVersion(CompatibilityVersion.Version_2_1); //ÆôÓÿçÓò services.AddCors(); services.AddControllers().AddJsonOptions(options => { //ÖÐÎÄÂÒÂë options.JsonSerializerOptions.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping; //ºöÂÔ¿ÕÖµ options.JsonSerializerOptions.IgnoreNullValues = true; //ºöÂÔ×Ô¶ÁÊôÐÔ //options.JsonSerializerOptions.IgnoreReadOnlyProperties = true; //ºöÂÔ´óСд options.JsonSerializerOptions.PropertyNameCaseInsensitive = true; //´óСд´¦Àí options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; ; }); services.AddMvc().AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver()); }