Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Aspire can't connect to Redis in container for SignalR backplane

$
0
0

I have a generic .NET Blazor web application with Aspire enabled and I'm trying to setup SignalR to use Redis as backplane. The Redis is running in a docker/podman container, and Aspire dashboard indicates that it's running properly. I am also able to hit Redis server by telnetting into it.

Here's the code from AppHost's Program.cs

var builder = DistributedApplication.CreateBuilder(args);var redis = builder.AddRedis("redis-cache");builder.AddProject<Projects.BlazorSingalRApp1>("blazorsingalrapp1")    .WithReference(redis);builder.Build().Run();

And here's how the API service (BlazorSingalRApp1) project's program.cs is configured

builder.Services.AddSignalR()    .AddStackExchangeRedis("redis-cache", options =>    {        options.Configuration.ChannelPrefix = "MyApp";        options.Configuration.AbortOnConnectFail = false;    });

However, when I run the apphost, the backend API service can't connect and the logs show

fail: Microsoft.AspNetCore.SignalR.StackExchangeRedis.RedisHubLifetimeManager[7] Not connected to Redis.

Is there anything missing?

Checked the logs of Redis container, no issues.However if I try to post messages, the backend throws this error

StackExchange.Redis.RedisConnectionException: UnableToConnect on redis-cache:6379/Subscription

It appears that maybe AddStackExchangeRedis call doesn't honor the connection string coming from Aspire.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>