Microsoft.Extensions.ServiceDiscovery.Yarp
8.0.0-preview.3.24105.21
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Extensions.ServiceDiscovery.Yarp --version 8.0.0-preview.3.24105.21
NuGet\Install-Package Microsoft.Extensions.ServiceDiscovery.Yarp -Version 8.0.0-preview.3.24105.21
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery.Yarp" Version="8.0.0-preview.3.24105.21" />
paket add Microsoft.Extensions.ServiceDiscovery.Yarp --version 8.0.0-preview.3.24105.21
#r "nuget: Microsoft.Extensions.ServiceDiscovery.Yarp, 8.0.0-preview.3.24105.21"
// Install Microsoft.Extensions.ServiceDiscovery.Yarp as a Cake Addin #addin nuget:?package=Microsoft.Extensions.ServiceDiscovery.Yarp&version=8.0.0-preview.3.24105.21&prerelease // Install Microsoft.Extensions.ServiceDiscovery.Yarp as a Cake Tool #tool nuget:?package=Microsoft.Extensions.ServiceDiscovery.Yarp&version=8.0.0-preview.3.24105.21&prerelease
Microsoft.Extensions.ServiceDiscovery.Yarp
The Microsoft.Extensions.ServiceDiscovery.Yarp
library adds support for resolving endpoints for YARP clusters, by implementing a YARP destination resolver.
Usage
Resolving YARP cluster destinations using Service Discovery
The IReverseProxyBuilder.AddServiceDiscoveryDestinationResolver()
extension method configures a YARP destination resolver. To use this method, you must also configure YARP itself as described in the YARP documentation, and you must configure .NET Service Discovery via the Microsoft.Extensions.ServiceDiscovery library.
Direct HTTP forwarding using Service Discovery Forwarding HTTP requests using IHttpForwarder
YARP supports direct forwarding of specific requests using the IHttpForwarder
interface. This, too, can benefit from service discovery using the Microsoft.Extensions.ServiceDiscovery library. To take advantage of service discovery when using YARP Direct Forwarding, use the IServiceCollection.AddHttpForwarderWithServiceDiscovery
method.
For example, consider the following .NET Aspire application:
var builder = WebApplication.CreateBuilder(args);
// Configure service discovery
builder.Services.AddServiceDiscovery();
// Add YARP Direct Forwarding with Service Discovery support
builder.Services.AddHttpForwarderWithServiceDiscovery();
// ... other configuration ...
var app = builder.Build();
// ... other configuration ...
// Map a Direct Forwarder which forwards requests to the resolved "catalogservice" endpoints
app.MapForwarder("/catalog/images/{id}", "http://catalogservice", "/api/v1/catalog/items/{id}/image");
app.Run();
In the above example, the YARP Direct Forwarder will resolve the catalogservice using service discovery, forwarding request sent to the /catalog/images/{id}
endpoint to the destination path on the resolved endpoints.
Feedback & contributing
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.ServiceDiscovery (>= 8.0.0-preview.3.24105.21)
- Microsoft.Extensions.ServiceDiscovery.Abstractions (>= 8.0.0-preview.3.24105.21)
- Yarp.ReverseProxy (>= 2.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Microsoft.Extensions.ServiceDiscovery.Yarp:
Package | Downloads |
---|---|
Aspirant.Hosting.Yarp
A custom YARP ingress resource for .NET Aspire App Host projects. |
GitHub repositories (6)
Showing the top 5 popular GitHub repositories that depend on Microsoft.Extensions.ServiceDiscovery.Yarp:
Repository | Stars |
---|---|
dotnet/eShop
A reference .NET application implementing an eCommerce site
|
|
davidfowl/TodoApp
Todo application with ASP.NET Core Blazor WASM, Minimal APIs and Authentication
|
|
dotnet/aspire-samples
|
|
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
|
|
Azure-Samples/eShopOnAzure
A variant of https://github.com/dotnet/eShop that uses Azure services
|
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 4,905 | 11/12/2024 |
9.0.0-rc.1.24511.1 | 3,659 | 10/15/2024 |
8.2.2 | 4,837 | 10/24/2024 |
8.2.1 | 10,795 | 9/26/2024 |
8.2.0 | 18,664 | 8/29/2024 |
8.1.0 | 15,462 | 7/23/2024 |
8.0.2 | 10,945 | 6/28/2024 |
8.0.1 | 30,901 | 5/21/2024 |
8.0.0 | 5,544 | 5/21/2024 |
8.0.0-preview.7.24251.11 | 6,713 | 5/7/2024 |
8.0.0-preview.6.24214.1 | 7,667 | 4/23/2024 |
8.0.0-preview.5.24201.12 | 5,960 | 4/9/2024 |
8.0.0-preview.4.24156.9 | 8,056 | 3/12/2024 |
8.0.0-preview.3.24105.21 | 6,276 | 2/13/2024 |
8.0.0-preview.2.23619.3 | 8,297 | 12/20/2023 |
8.0.0-preview.1.23557.2 | 8,356 | 11/14/2023 |