报表速度提升
This commit is contained in:
@ -9,6 +9,10 @@ using System;
|
||||
using System.Reflection;
|
||||
using HT.Cloud.Code;
|
||||
using HT.Cloud.Service;
|
||||
using Microsoft.AspNetCore.ResponseCompression;
|
||||
using System.IO.Compression;
|
||||
using System.Net.Sockets;
|
||||
using System.Linq;
|
||||
|
||||
namespace HT.Cloud.Web
|
||||
{
|
||||
@ -20,7 +24,30 @@ namespace HT.Cloud.Web
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
base.ConfigureServices(services);
|
||||
services.Configure<BrotliCompressionProviderOptions>(options =>
|
||||
{
|
||||
options.Level = CompressionLevel.Fastest;
|
||||
}).Configure<GzipCompressionProviderOptions>(options =>
|
||||
{
|
||||
options.Level = CompressionLevel.Fastest;
|
||||
}).AddResponseCompression(options =>
|
||||
{
|
||||
options.EnableForHttps = true;
|
||||
options.Providers.Add<BrotliCompressionProvider>();
|
||||
options.Providers.Add<GzipCompressionProvider>();
|
||||
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[]
|
||||
{
|
||||
//"text/html",
|
||||
"json/html; charset=utf-8",
|
||||
"text/html; charset=utf-8",
|
||||
"application/xhtml+xml",
|
||||
"application/atom+xml",
|
||||
"image/svg+xml"
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
base.ConfigureServices(services);
|
||||
services.AddDefaultSwaggerGen(Assembly.GetExecutingAssembly().GetName().Name)
|
||||
.AddSqlSugar()
|
||||
.AddQuartz()
|
||||
@ -41,6 +68,9 @@ namespace HT.Cloud.Web
|
||||
// 返回数据首字母不小写,CamelCasePropertyNamesContractResolver是小写
|
||||
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
||||
});
|
||||
|
||||
|
||||
|
||||
//调试前端可更新
|
||||
services.AddControllersWithViews().AddRazorRuntimeCompilation();
|
||||
//清理缓存
|
||||
@ -57,8 +87,8 @@ namespace HT.Cloud.Web
|
||||
public override void Configure(IApplicationBuilder app)
|
||||
{
|
||||
base.Configure(app);
|
||||
//MVC路由
|
||||
app.UseMiddleware(typeof(GlobalExceptionMiddleware))
|
||||
//MVC路由
|
||||
app.UseMiddleware(typeof(GlobalExceptionMiddleware))
|
||||
.AddDefaultSwaggerGen()
|
||||
.UseEndpoints(endpoints =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user