Skip to content

Deployment with Blazor and Orleans has Connection Loss in Container Apps #7990

@rbuergi

Description

@rbuergi

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have been trying to resolve this for a long time. I have a solution with

  1. Blazor Interactive Server (1 replica)
  2. Orleans Silo (1 replica with clustering in Table Storage)

I have studied the azure samples and have configured the settings as I have found them. I have two major problems:

1. Antiforgery

When I reload the pages several times, it keeps rejecting the antiforgery with the message

The key <GUID> was not found in the key ring. For more information go to https://aka.ms/aspnet/dataprotectionwarning

I have found the related issue with a similar problem, but it was closed without any solution.

Copilot suggests to persist the key, but the link in the template for ServiceDefaults suggests it is not needed and it can be a security leak. Furthermore, I see that the azure blob persistence is outdated. How am I supposed to persist? on a postgresql db? I had persisted it before on Redis but kept losing connection to Redis.

2. Loss of Orleans connection

After fresh reboot, the Orleans connection works perfectly. But I keep losing the connection to Orleans after a few operations. Messages:

Unable to connect to 100.100.197.216:8001. Error: ConnectionRefused
The target silo became unavailable for message: Request [S100.100.197.216:8000:100649356 sys.client/hosted-100.100.197.216:8000@100649356]->[S100.100.197.216:8000:100649243 sys.svc.manifest/100.100.197.216:8000@100649243] Orleans.Runtime.ISiloManifestSystemTarget.GetSiloManifest() #1529AAFAF527C116. See https://aka.ms/orleans-troubleshooting for troubleshooting help.

Is this related with the antiforgery problem?

I have tried to re-configure Orleans as follows:

  1. In AppHost
buiklder.AddProject<Orleans>
<Orleans Config>
    .WithEnvironment("ORLEANS_NETWORKING_REUSEADDRESS", "true")
    .WithEnvironment("ORLEANS_NETWORKING_KEEPALIVEENABLED", "true")
    .WithEnvironment("ORLEANS_NETWORKING_KEEPALIVEINTERVAL", "60") // seconds
    .WithEnvironment("ORLEANS_NETWORKING_KEEPALIVETIMEOUT", "300"); // seconds;

silo

        services.Configure<SiloMessagingOptions>(options =>
        {
            // Increase timeouts
            options.ResponseTimeout = TimeSpan.FromSeconds(30);
            options.ResponseTimeoutWithDebugger = TimeSpan.FromMinutes(5);
        });

        services.Configure<ConnectionOptions>(options =>
        {
            // Increase connection retry settings
            options.OpenConnectionTimeout = TimeSpan.FromSeconds(30);
        });

but this has no effect.

Before I had a setup with Redis, and I kept loosing the connection, thus I replaced with Azure Blobs.

Is the container apps environment not stable enough to run an aspire system?

Expected Behavior

In your PR you suggest that it should all be so easy. I believe I have a fairly standard setup, but I notice that none of your examples actually cover this case -- the Orleans Voting example is co-hosted thus avoiding this problem. Have you ever tested this setup? Or is the setup with container apps simply not working in principle?

Thanks for any help, I am getting desperate.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version info

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions