public static IApplicationBuilder MapGetFile(this IApplicationBuilder app, IFileserverConfig <HttpRequest> config) { app.MapWhen(c => HttpMethod.Get.Method.Equals(c.Request.Method, StringComparison.OrdinalIgnoreCase), builder => { builder.Run(async context => { var handler = new GetFileHandler( builder.ApplicationServices.GetService(typeof(ILoggerFactory)) as ILoggerFactory, config.GetFilePipeline()); await handler.Invoke(context); }); }); return(app); }