I created Blazor server web app and I deployed on Azure App Service, and in Network tab I see alot of requests to https://mywebsites0123.azurewebsites.net/_blazor?id=3OO-T6L4Bu9bMRF8QAo_5Q&_=166722 and make application unstable.
On localhost (Debug and Release) I cannot find any request and application is working smooth.
I read this C# Blazor server - why so many _blazor requests and such memory consumption? but can't find solution.
The startup page looks like:
ConfigureServices(IServiceCollection services)
services.AddRazorPages();services.AddServerSideBlazor().AddMicrosoftIdentityConsentHandler();services.AddSignalR(e =>{ e.MaximumReceiveMessageSize = 2000 * 1024;});// Radzen initservices.AddScoped<DialogService>();services.AddScoped<TooltipService>();services.AddScoped<NotificationService>();services.AddMemoryCache();var apiScope = Configuration["Authentication:ApiScope"];services.AddMicrosoftIdentityWebAppAuthentication(Configuration, "Authentication:AzureAd").EnableTokenAcquisitionToCallDownstreamApi(new string[] { apiScope }).AddInMemoryTokenCaches();services.AddControllersWithViews().AddMicrosoftIdentityUI();services.AddAuthorization();and
Configure(IApplicationBuilder app, IWebHostEnvironment env)
if (env.IsDevelopment()){ app.UseDeveloperExceptionPage();}else{ app.UseExceptionHandler("/Error"); app.UseHsts();}app.UseHttpsRedirection();app.UseStaticFiles();app.UseRouting();app.UseAuthentication();app.UseAuthorization();app.UseEndpoints(endpoints =>{ endpoints.MapControllers(); endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host");});After few seconds later:
And then number of requests continue to increase. Don't know why this happens when app is hosted on Azure app service.
Any tips to look for ?
Solution:
Enable on Azure AppService the WebSockets (by default is Off) described: https://learn.microsoft.com/en-us/aspnet/core/signalr/publish-to-azure-web-app?view=aspnetcore-6.0#configure-the-app-in-azure-app-service


