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

Deploying Blazor app to Azure Linux App Service - seemingly random web socket failures

$
0
0

I have a Blazor app that I have deployed to an Azure App Service. The Blazor app is all InteractiveServer render mode. After performing the same task several times succesfully I will suddenly get multiple console errors as shown below. Every time it happens I can get back to normal with refreshing the page 1+ times (sometimes as many as 5 refreshes)

Error: Failed to start the transport 'WebSockets': Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.

GET https://app-[removed]-001.azurewebsites.net/blazor?id=f9NSvVeKErKRUaRJWvmrfA&=1724694010721

Error: Failed to start the transport 'LongPolling': Error: No Connection with that ID: Status code '404'

Error: Failed to start the connection: Error: Unable to connect to the server with any of the available transports. Error: WebSockets failed: Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled. ServerSentEvents failed: Error: 'ServerSentEvents' does not support Binary. Error: LongPolling failed: Error: No Connection with that ID: Status code '404'

This is a small application that registers a DbContext, a ServiceBus Client, and a couple services; this is the full Program.cs

using HelpDesk.Components;using Microsoft.EntityFrameworkCore;using Microsoft.Extensions.Azure;using HelpDesk.Services;using HelpDesk.Data;using MudBlazor.Services;var builder = WebApplication.CreateBuilder(args);builder.Services.AddMudServices();// Add services to the container.builder.Services.AddRazorComponents()    .AddInteractiveServerComponents();builder.Services.AddDbContext<SpContext>(    opt => opt.UseSqlServer(builder.Configuration.GetConnectionString("StoredProcedureUser")), ServiceLifetime.Transient);builder.Services.AddAzureClients(ab => {    ab.AddServiceBusClient(builder.Configuration["AzureWebJobsServiceBus"]);});builder.Services.AddTransient<IProceduresService, ProceduresService>();builder.Services.AddTransient<ServiceBusService>();var app = builder.Build();// Configure the HTTP request pipeline.if (!app.Environment.IsDevelopment()){    app.UseExceptionHandler("/Error", createScopeForErrors: true);    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.    app.UseHsts();}app.UseHttpsRedirection();app.UseStaticFiles();app.UseAntiforgery();app.MapRazorComponents<App>()    .AddInteractiveServerRenderMode();app.Run();

This is the .csproj:

<PropertyGroup><TargetFramework>net8.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings><UserSecretsId>foo</UserSecretsId></PropertyGroup><PropertyGroup Condition=" '$(RunConfiguration)' == 'https'" /><PropertyGroup Condition=" '$(RunConfiguration)' == 'http'" /><ItemGroup><PackageReference Include="Azure.Messaging.ServiceBus" Version="7.18.1" /><PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" /><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" /><PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.5" /><PackageReference Include="MudBlazor" Version="7.6.0" /></ItemGroup></Project>

This is just a test project for me to try out Blazor. The information I've found on why this might be happening:

  1. App Service Plan; I'm on Basic so I shouldn't have an issue with the amount of WebSockets connections
  2. Not using SignalR; I can't seem to find reliable information on if I must use SignalR or not.

I'm hoping someone has more insight into why this might be happening.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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