public async Task Invoke(HttpContext context) { var environment = (IApplicationEnvironment)context.RequestServices.GetService(typeof(IApplicationEnvironment)); if (context.GetFeature <IHttpSendFileFeature>() == null) { var sendFile = new SendFileFallBack(context.Response.Body, environment.ApplicationBasePath); context.SetFeature <IHttpSendFileFeature>(sendFile); } await _next(context); }
public async Task Invoke(HttpContext context) { var environment = (IApplicationEnvironment)context.RequestServices.GetService(typeof(IApplicationEnvironment)); if (context.Features.Get<IHttpSendFileFeature>() == null) { var sendFile = new SendFileFallBack(context.Response.Body, environment.ApplicationBasePath); context.Features.Set<IHttpSendFileFeature>(sendFile); } await _next(context); }