Api: RegisterForDispose DisposableHttpContext

This commit is contained in:
pavelbannov 2019-08-05 15:37:33 +03:00
parent c34b1a0d95
commit 1fd62e757c
2 changed files with 18 additions and 1 deletions

View File

@ -6,6 +6,7 @@ using ASC.Api.Core.Middleware;
using ASC.Common.DependencyInjection;
using ASC.Common.Logging;
using ASC.Common.Utils;
using ASC.Common.Web;
using ASC.Core;
using ASC.Data.Reassigns;
using ASC.Data.Storage.Configuration;
@ -120,9 +121,17 @@ namespace ASC.People
Thread.CurrentThread.CurrentCulture = user.GetCulture();
Thread.CurrentThread.CurrentCulture = user.GetCulture();
}
await next.Invoke();
});
app.Use(async (context, next) =>
{
context.Response.RegisterForDispose(new DisposableHttpContext(context));
await next();
});
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
@ -132,7 +141,6 @@ namespace ASC.People
app.UseCSP();
app.UseCm();
app.UseWebItemManager();
app.UseStaticFiles();
}
}

View File

@ -1,10 +1,12 @@
using System.Threading;
using ASC.Api.Core;
using ASC.Api.Core.Core;
using ASC.Api.Core.Middleware;
using ASC.Common.DependencyInjection;
using ASC.Common.Logging;
using ASC.Common.Utils;
using ASC.Common.Web;
using ASC.Core;
using ASC.Data.Reassigns;
using ASC.Data.Storage.Configuration;
@ -115,6 +117,13 @@ namespace ASC.Web.Api
await next.Invoke();
});
app.Use(async (context, next) =>
{
context.Response.RegisterForDispose(new DisposableHttpContext(context));
await next();
});
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();