Posts

Showing posts with the label service-discovery

Service Discovery in .NET

This was ported from my original blog post here . Introduction Service Discovery  is a common pattern in distributed systems, like microservices, where one does not need to know the exact address of a resource, instead we ask some kind of database-backed service to get it for us. This is very useful to prevent hardcoding such addresses, instead they are discovered dynamically at runtime. There may be other functionality, but it may also include checking the health of a service first, or rotating the exact address to return, when there are many possibilities. Service discovery is supported in .NET  since version 8, through the  Microsoft.Extensions.ServiceDiscovery  Nuget package. It's a very simple implementation, which I will cover here, the code is made available under the  Microsoft Aspire repo . More advanced service discovery providers include, to name just a few: Consul Etcd Zookeeper Eureka All of these have libraries available for .NET, for free o...