Microsoft.Extensions.ServiceDiscovery.Yarp
8.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Extensions.ServiceDiscovery.Yarp --version 8.0.0
NuGet\Install-Package Microsoft.Extensions.ServiceDiscovery.Yarp -Version 8.0.0
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery.Yarp" Version="8.0.0" />
paket add Microsoft.Extensions.ServiceDiscovery.Yarp --version 8.0.0
#r "nuget: Microsoft.Extensions.ServiceDiscovery.Yarp, 8.0.0"
// Install Microsoft.Extensions.ServiceDiscovery.Yarp as a Cake Addin #addin nuget:?package=Microsoft.Extensions.ServiceDiscovery.Yarp&version=8.0.0 // Install Microsoft.Extensions.ServiceDiscovery.Yarp as a Cake Tool #tool nuget:?package=Microsoft.Extensions.ServiceDiscovery.Yarp&version=8.0.0
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)
- Microsoft.Extensions.ServiceDiscovery.Abstractions (>= 8.0.0)
- 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 (7)
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
|
|
thangchung/practical-dotnet-aspire
The practical .NET Aspire builds on the coffeeshop app business domain
|
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 6,720 | 11/12/2024 |
9.0.0-rc.1.24511.1 | 3,843 | 10/15/2024 |
8.2.2 | 5,202 | 10/24/2024 |
8.2.1 | 10,992 | 9/26/2024 |
8.2.0 | 19,228 | 8/29/2024 |
8.1.0 | 15,708 | 7/23/2024 |
8.0.2 | 11,031 | 6/28/2024 |
8.0.1 | 31,220 | 5/21/2024 |
8.0.0 | 5,583 | 5/21/2024 |
8.0.0-preview.7.24251.11 | 6,806 | 5/7/2024 |
8.0.0-preview.6.24214.1 | 7,718 | 4/23/2024 |
8.0.0-preview.5.24201.12 | 5,962 | 4/9/2024 |
8.0.0-preview.4.24156.9 | 8,060 | 3/12/2024 |
8.0.0-preview.3.24105.21 | 6,322 | 2/13/2024 |
8.0.0-preview.2.23619.3 | 8,306 | 12/20/2023 |
8.0.0-preview.1.23557.2 | 8,362 | 11/14/2023 |