public static IApplicationBuilder UseStaticHttpContext(this IApplicationBuilder app) { IHttpContextAccessor httpContextAccessor = app.ApplicationServices.GetRequiredService <IHttpContextAccessor>(); HttpContext.ConfigureHttpContext(httpContextAccessor); IHostingEnvironment env = app.ApplicationServices.GetRequiredService <IHostingEnvironment>(); HttpContext.ConfigureHostingEnvironment(env); IMemoryCache cache = app.ApplicationServices.GetRequiredService <IMemoryCache>(); HttpContext.ConfigureMemoryCache(cache); HttpApplicationStatecs application = app.ApplicationServices.GetRequiredService <HttpApplicationStatecs>(); HttpContext.ConfigureApplication(application); return(app); }
internal static void ConfigureApplication(HttpApplicationStatecs application) { _application = application; }