dotNet Core 2.1

Selectively Caching a HttpResponseMessage with Polly - caching series 1/3

Full source code here. Want to learn more about Polly? Check out my Pluralsight course on it. When I give talks on Polly I show how to use it in a Web API application that calls another Web Api application.

How to Dependency Inject a Service from Startup back in Program

Full source code here. While writing some recent blog posts on HttpClientFactory I had to work with some of the obscure features of ServiceCollection and dependency injection in .NET Core 2.

Dynamically Updating the Request Header of a HttpClientFactory Generated HttpClient, Part 2

Full source code here. This is a alternative to the approach described in a previous post. On a slack channel there was some discussion around the use of a little known extension method on HttpClientBuilder, ConfigureHttpClient.

How to Turn Off Console Logging for Kestrel in .NET Core

This post is mostly a note to myself. I am often annoyed with the amount of logging to the console that occurs when I start a Kestrel hosted application and I can never remember how to turn it off.

Dynamically Updating the Request Header of a HttpClientFactory Generated HttpClient, Part 1

Full source code here. There are some subtle issues in the way I use DI in this post, see here for an alternative if you don’t want to follow this approach

Loading Config from Multiple Sources with .NET Core 2.x Web Api or MVC

Full source code available here. .NET Core 2 and .NET Core 2.1 offer many ways to load configuration and they are well documented by Microsoft. But there is one scenario that I didn’t see explained.

Getting .NET Core 2.1 Preview 2 Working with Visual Studio 2017

About a year ago I wanted to start using .NET Framework 4.7, it should have been an easy process, but wasn’t. After some trial and error if figured it out and wrote a blog post explaining how to get it working.