using BLAIzor.Components; using BLAIzor.Data; using BLAIzor.Helpers; using BLAIzor.Services; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.EntityFrameworkCore; using Radzen; using Sidio.Sitemap.AspNetCore; using Sidio.Sitemap.Blazor; using Sidio.Sitemap.Core.Services; var builder = WebApplication.CreateBuilder(args); var configuration = builder.Configuration; builder.WebHost.UseWebRoot("wwwroot"); // Add services to the container. builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); // Add Identity services builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); //builder.Services.AddBlazorServerOptions(options => //{ // options.MaxBufferSize = 50 * 1024 * 1024; // Set to 50 MB //}); builder.Services.Configure(options => { options.Limits.MaxRequestBodySize = 50 * 1024 * 1024; }); // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); builder.Services.AddRadzenComponents(); builder.Services.AddHttpClient(); builder.Services.AddScoped(); builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services .AddHttpContextAccessor() .AddDefaultSitemapServices(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.Configure(builder.Configuration.GetSection("Smtp")); builder.Services.AddTransient(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddHostedService(); builder.Services.AddServerSideBlazor().AddCircuitOptions(options => options.DetailedErrors = true).AddHubOptions(options => { options.MaximumReceiveMessageSize = 1024000; // e.g. 100 KB }); ; builder.Services.AddSignalR(hubOptions => { hubOptions.MaximumReceiveMessageSize = 10 * 1024 * 1024; }); 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.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseStaticFiles(); app.UseAntiforgery(); app.MapRazorPages(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); app.UseMiddleware(); app.UseSitemap(); app.Run();