dotnet / aspire-samples

MIT License
610 stars 174 forks source link

Show how to use aspire components with existing ASP.NET Core features #9

Open davidfowl opened 10 months ago

davidfowl commented 10 months ago
josephaw1022 commented 7 months ago

@davidfowl Is this what you are referring to in your first point?

https://learn.microsoft.com/en-us/aspnet/core/signalr/redis-backplane?view=aspnetcore-8.0

andrebtoe commented 4 months ago

Is there no implementation for "Redis aspire component with SignalR" yet?

josephaw1022 commented 4 months ago

@andrebtoe Should be able to just create a redis resource in your app host and then have your signalr backplane point to it, seen here Link To Documentation

App Host


var builder = DistributedApplication.CreateBuilder(args);

var redis = builder.AddRedis("cache");

var apiservice = builder.AddProject<Projects.AspireRedis_ApiService>("apiservice")
    .WithReference(redis);

builder.Build().Run();

The Api Service

// ...

builder.Services.AddSignalR().AddStackExchangeRedis("cache");

// ...