-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I have a Blazor Server Application which is hosted on an Azure App Service that has a random connection error. When it occurs, the following errors are in the browser console window:
- WebSocket connection to 'website/_blazor?id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' failed:
- Information: (WebSockets transport) There was an error with the transport
- 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 preseent on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.
- Failed to load resource: the server responded with a status of 404 (Nout Found)
- Error: Connection disconnected with error 'Error: No Connection with that ID: Status code '404'
- Warning: Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection
- Error: Failed to start the circuit
Expected Behavior
Blazor Server Application running on an Azure App Service with SignalR should run without random loading errors.
Steps To Reproduce
Here is the code from Program.cs file, if it helps:
using BlazorServerApp.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Connections;
using Microsoft.EntityFrameworkCore;
using System;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR();
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// 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.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();
Exceptions (if any)
No response
.NET Version
.NET 6.0
Anything else?
No response