Pre-compressed static files in self host Asp.Net Core

When using StaticFileMiddleware and ResponseCompressionMiddleware, each file is read from slow disk uncompressed and then dynamically compressed (consuming CPU each time). It’s clearly ineffective in terms of CPU, disk and time.

A better approach is to pre compress some files on disk, mark them as already compressed using some kind of metadata and return them as is if compression is accepted or decompressed them dynamically.

This library provides a middelware to do it: AnderssonPeter/CompressedStaticFiles: middelware for Kestrel to serve precompressed static files.

It started with Use pre-gzipped content files? GitHub #1584.


EDIT: Also found a non core implementation. More limited but (gz only) but usefull: (it’s a StaticFilesMiddleware replacement).


A middleware to provide specific html pages for some error and default one for others while returning correct http error code as status: Re-execute the middleware pipeline with the StatusCodePages Middleware to create custom error pages.

We can also want to know the original path that actually caused the error: pretty easy using Request Features in ASP.NET Core and querying for IStatusCodeReExecuteFeature. In fact, current implementation of this interface also provides error query string (but it will not be reflected into interface before .Net 2.0): Retrieving the path that generated an error with the StatusCodePages Middleware

ReadLine comes to .Net (Core and full)

ReadLine is a GNU Readline like library built in pure C#. It can serve as a drop in replacement for the inbuilt Console.ReadLine() and brings along with it some of the terminal goodness you get from unix shells, like command history navigation and tab auto completion.

An AutoCompletionHandler callback  can be used to provide an array of suggestion.

tsolarin/readline: A GNU-Readline like library for .NET/.NET Core