Posted in:

A couple of months ago I released a Pluralsight course entitled Versioning and Evolving Microservices in ASP.NET Core. The reason I haven't blogged about it until now, is that it was developed to be part of a "learning path" on Pluralsight covering a wide range of topics relating to building microservices in ASP.NET Core. That learning path is now live, and contains some fantastic contributions by several other superb Pluralsight authors. The advantage of this learning path is that all the courses use the same demo application, making it easier to demonstrate how the various techniques affect

In the course I emphasize the importance of maintaining backwards compatibility. This is something easily forgotten by developers who are new to microservices, as they can often assume that it's possible to upgrade a service at exactly the same instant all of its clients are updated.

We look at several versioning strategies for HTTP APIs (e.g. versioning in the URL query string, path or request headers), and I show how the Microsoft.AspNet.Core.Versioning NuGet package greatly simplifies the task of implementing versioning for your ASP.NET controller endpoints.

I also include a module on versioning messages. Any messages that flow between microservices should also be considered part of the public API "contract" of the microservice, and therefore backwards compatibility should also be taken into account when you are evolving the design of your message payloads.

I also tried to encourage the idea of creating "integration tests" that protect against backwards compatibility regressions. This is a good way of guarding against accidental breakages, and if you run those tests in a staging environment as part of a continuous delivery process, they can prevent you from getting all the way to production before discovering there is a problem.

Versioning is perhaps not the most exciting of topics, but you can be certain that if you are developing microservices, their public APIs will evolve over time and it's important to have a clear idea of how you are going to manage versioning and ensure that you don't run into backwards compatibility issues in production.