Controlling IHostedService execution order in ASP.NET Core 3.x
ASP.NET Core 3.0 re-platformed the WebHostBuilder on top of the generic IHost abstraction, so that Kestrel runs in an IHostedService. Any IHostedService implementations you add to...
View ArticleShould you unit-test API/MVC controllers in ASP.NET Core?
Based on Betteridge's law of headlines: no! But based on recent twitter activity, that's no doubt a somewhat controversial opinion, so in this post I look at what a unit-test for an API controller...
View ArticleAn Introduction to Kubernetes: Deploying ASP.NET Core applications to...
This post is the first in a series on deploying ASP.NET Core applications to Kubernetes. In this series I'll cover a variety of topics and things I've learned in deploying applications to Kubernetes....
View ArticleConfiguring resources with YAML manifests: Deploying ASP.NET Core...
In my previous post I talked about some of the fundamental components of Kubernetes like pods, deployments, and services. In this post I'll show how you can define and configure these resources using...
View ArticleAn introduction to deploying applications with Helm: Deploying ASP.NET Core...
In the first post in this series I described some of the fundamental Kubernetes resources that you need to understand when deploying applications, like pods, deployments, and services. In my previous...
View ArticleCreating a Helm chart for an ASP.NET Core app: Deploying ASP.NET Core...
So far in this series I've provided a general introduction to Kubernetes. In this post we get more concrete: we'll create a Helm chart for deploying a small ASP.NET Core application to Kubernetes....
View ArticleSetting environment variables for ASP.NET Core apps in a Helm chart:...
So far in this series I've provided a general introduction to Kubernetes and Helm, and we've deployed a basic ASP.NET Core solution using a Helm chart. In this post we extend the Helm chart to allow...
View ArticleAdding health checks with Liveness, Readiness, and Startup probes: Deploying...
In previous posts in this series you've seen how to deploy an ASP.NET Core application to Kubernetes using Helm, and how to configure your applications by injecting environment variables. In this post...
View ArticleRunning database migrations when deploying to Kubernetes: Deploying ASP.NET...
In this post I deal with a classic thorny issue that quickly arises when you deploy to a highly-replicated production environment: database migrations. I discuss various possible solutions to the...
View ArticleRunning database migrations using jobs and init containers: Deploying ASP.NET...
In the previous post I described several ways to run database migrations when deploying to Kubernetes. In this post, I show to implement my preferred approach using Kubernetes Jobs and init containers....
View ArticleMonitoring Helm releases that use jobs and init containers: Deploying ASP.NET...
In the previous post in this series, I showed how I prefer to run database migrations when deploying ASP.NET Core applications to Kubernetes. One of the downsides of the approach I described, in which...
View ArticleCreating an 'exec-host' deployment for running one-off commands: Deploying...
In this post I describe a pattern that lets you run arbitrary commands for your application in your Kubernetes cluster, by having a pod available for you to exec into. You can use this pod to perform...
View ArticleAvoiding downtime in rolling deployments by blocking SIGTERM: Deploying...
This post is a bit of a bonus—I was originally going to include it as one of my smaller tips in the final post of the series, but it's unexpected enough that I think it's worth it having its own post....
View ArticleTips, tricks, and edge cases: Deploying ASP.NET Core applications to...
This is the last post in the series, in which I describe a few of the smaller pieces of advice, tips, and info I found when running applications on Kubernetes. Many of these are simple things to keep...
View ArticleApplying the MVC design pattern to Razor Pages
With the recent release of .NET 5.0, I'm hard at work updating the code and content of the second edition of my book ASP.NET Core in Action, Second Edition. This post gives you a sample of what you can...
View ArticleUsing Quartz.NET with ASP.NET Core and worker services
This is an update to a post from 18 months ago in which I described how to use Quartz.NET to run background tasks by creating an an ASP.NET Core hosted service. There's now an official package,...
View ArticleUsing action results and content negotiation with "route-to-code" APIs
In this post post I show that you can combine some techniques from MVC controllers with the new "route-to-code" approach. I show how you can use MVC's automatic content negotiation feature to return...
View ArticleShould I use self-contained or framework-dependent publishing in Docker images?
ASP.NET Core has two different publishing modes, framework-dependent and self-contained. In this post I compare the impact of the publishing mode on Docker image size. I compare an image published...
View ArticleAuto-assigning issues using a GitHub Action: Creating my first GitHub app...
About 18 months ago, I wrote a GitHub app that would automatically assign any issues raised in a GitHub repository to a specific user using Probot. However, GitHub apps are essentially deprecated at...
View ArticleAn introduction to the Data Protection system in ASP.NET Core
In this post I provide a primer on the ASP.NET Core data-protection system: what it is, why do we need it, and how it works at a high level. Why do we need the data-protection system? The...
View Article