This sample code uses YamlDotNet to parse yaml and inherits from FileConfigurationSource and FileConfigurationProvider: Creating a custom ConfigurationProvider in ASP.NET Core to parse YAML.
A very usefull minimal http static file server in Asp.Net core (Starting a http file server from the file explorer using .NET Core – Meziantou’s blog). Can also be regsitered in Explorer contextual menu.
How to use CookieTempDataProvider to prevent requerying data during subsequent get request: Post-Redirect-Get and TempData with ASP.NET Core – Meziantou’s blog
On the road to breaking size limits, the futur of protobuf-net could be using Utf8String, Span<T>,ValueTask<T> when usefull and “Channels” (from corefxlab): Code, code and more code.: protobuf-net: large data, and the future
AspNetCoreRateLimit is an ASP.NET Core rate limiting solution designed to control the rate of requests that clients can make to a Web API or MVC app based on IP address or client ID.
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: asp.net 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: https://github.com/damianh/StaticFilesMiddleware (it’s a StaticFilesMiddleware replacement).
Asp.Net Core provides a unified model for MVC and WebAPI and default templates use unified meta packages dependencies. This simplifies evolutions but we can also choose to lighten Web API using only needed dependencies. How to to it is detailed in Removing the MVC Razor dependencies from the Web API template in ASP.NET Core.
Sample code provides AddWebApi as a light version of AddMvc.
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
All is already said in title: Using strongly typed configuration in .NET Core console app.
Main interest of this post is to reaffirm that strongly typed configuration is not restricted to Asp.Net core. After all, an Asp.Net core are only command line programs making some http listening.
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.