![]() |
VOOZH | about |
dotnet add package Microsoft.Extensions.ServiceDiscovery.Dns --version 10.7.0
NuGet\Install-Package Microsoft.Extensions.ServiceDiscovery.Dns -Version 10.7.0
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery.Dns" Version="10.7.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery.Dns" Version="10.7.0" />Directory.Packages.props
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery.Dns" />Project file
paket add Microsoft.Extensions.ServiceDiscovery.Dns --version 10.7.0
#r "nuget: Microsoft.Extensions.ServiceDiscovery.Dns, 10.7.0"
#:package Microsoft.Extensions.ServiceDiscovery.Dns@10.7.0
#addin nuget:?package=Microsoft.Extensions.ServiceDiscovery.Dns&version=10.7.0Install as a Cake Addin
#tool nuget:?package=Microsoft.Extensions.ServiceDiscovery.Dns&version=10.7.0Install as a Cake Tool
This library provides support for resolving service endpoints using DNS (Domain Name System). It provides two service endpoint providers:
DNS, which resolves endpoints using DNS A/AAAA record queries. This means that it can resolve names to IP addresses, but cannot resolve port numbers endpoints. As such, port numbers are assumed to be the default for the protocol (for example, 80 for HTTP and 433 for HTTPS). The benefit of using the DNS provider is that for cases where these default ports are appropriate, clients can spread their requests across hosts. For more information, see Load-balancing with endpoint selectors.
DNS SRV, which resolves service names using DNS SRV record queries. This allows it to resolve both IP addresses and port numbers. This is useful for environments which support DNS SRV queries, such as Kubernetes (when configured accordingly).
The DNS service endpoint provider resolves endpoints using DNS A/AAAA record queries. This means that it can resolve names to IP addresses, but cannot resolve port numbers endpoints. As such, port numbers are assumed to be the default for the protocol (for example, 80 for HTTP and 433 for HTTPS). The benefit of using the DNS service endpoint provider is that for cases where these default ports are appropriate, clients can spread their requests across hosts. For more information, see Load-balancing with endpoint selectors.
To configure the DNS service endpoint provider in your application, add the DNS service endpoint provider to your host builder's service collection using the AddDnsServiceEndpointProvider method. service discovery as follows:
builder.Services.AddServiceDiscoveryCore();
builder.Services.AddDnsServiceEndpointProvider();
When deploying to Kubernetes, the DNS SRV service endpoint provider can be used to resolve endpoints. For example, the following resource definition will result in a DNS SRV record being created for an endpoint named "default" and an endpoint named "dashboard", both on the service named "basket".
apiVersion: v1
kind: Service
metadata:
name: basket
spec:
selector:
name: basket-service
clusterIP: None
ports:
- name: default
port: 8080
- name: dashboard
port: 8888
To configure a service to resolve the "dashboard" endpoint on the "basket" service, add the DNS SRV service endpoint provider to the host builder as follows:
builder.Services.AddServiceDiscoveryCore();
builder.Services.AddDnsSrvServiceEndpointProvider();
The special port name "default" is used to specify the default endpoint, resolved using the URI http://basket.
As in the previous example, add service discovery to an HttpClient for the basket service:
builder.Services.AddHttpClient<BasketServiceClient>(
static client => client.BaseAddress = new("http://basket"));
Similarly, the "dashboard" endpoint can be targeted as follows:
builder.Services.AddHttpClient<BasketServiceDashboardClient>(
static client => client.BaseAddress = new("http://_dashboard.basket"));
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on Microsoft.Extensions.ServiceDiscovery.Dns:
| Package | Downloads |
|---|---|
|
ServiceDiscovery.NET
Extensible service discovery for .NET |
|
|
Qiqiko.Shared.Hosting.Gateways
Package Description |
Showing the top 5 popular GitHub repositories that depend on Microsoft.Extensions.ServiceDiscovery.Dns:
| Repository | Stars |
|---|---|
|
abpframework/eShopOnAbp
Reference microservice solution built with the ABP Framework and .NET, runs on Kubernetes with Helm configuration, includes API Gateways, Angular and ASP.NET Core MVC applications, PostgreSQL and MongoDB databases
|
|
|
thangchung/practical-dotnet-aspire
The practical .NET Aspire builds on the coffeeshop app business domain
|
|
|
ProfessionalCSharp/ProfessionalCSharp2021
Source code for Professional C# and .NET 2021 Edition (with updates for C# 11 and .NET 7)
|
|
|
aws/integrations-on-dotnet-aspire-for-aws
This repositry contains the integrations with .NET Aspire for AWS.
|
|
|
anuviswan/LearningPoint
A repository for learning different technologies, frameworks, features......
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 10.7.0 | 884 | 6/9/2026 | |
| 10.6.0 | 5,397 | 5/12/2026 | |
| 10.5.0 | 12,718 | 4/15/2026 | |
| 10.4.0 | 12,300 | 3/10/2026 | |
| 10.3.0 | 11,577 | 2/10/2026 | |
| 10.2.0 | 9,519 | 1/13/2026 | |
| 10.1.0 | 15,320 | 12/9/2025 | |
| 10.0.0 | 19,523 | 11/11/2025 | |
| 9.5.2 | 22,678 | 10/23/2025 | |
| 9.5.1 | 18,176 | 10/3/2025 | |
| 9.5.0 | 5,017 | 9/25/2025 | |
| 9.4.2 | 10,459 | 9/2/2025 | |
| 9.4.1 | 6,811 | 8/12/2025 | |
| 9.4.0 | 6,963 | 7/29/2025 | |
| 9.3.1 | 36,489 | 6/10/2025 | |
| 9.3.0 | 10,121 | 5/19/2025 | |
| 9.2.1 | 7,740 | 4/24/2025 | 9.2.1 is deprecated because it is no longer maintained. |
| 9.2.0 | 4,693 | 4/10/2025 | 9.2.0 is deprecated because it is no longer maintained. |
| 9.1.0 | 14,285 | 2/25/2025 | 9.1.0 is deprecated because it is no longer maintained. |
| 9.0.0 | 46,956 | 11/12/2024 | 9.0.0 is deprecated because it is no longer maintained. |