Fix blazor.web.js 404: move App.razor and Routes.razor to Host project
Root cause: App.razor was in CentralUI (Microsoft.NET.Sdk.Razor RCL) but MapRazorComponents<App>().AddInteractiveServerRenderMode() serves _framework/blazor.web.js from the host assembly (Microsoft.NET.Sdk.Web). Per MS docs, the root component must be in the server (host) project. - Move App.razor and Routes.razor from CentralUI to Host/Components/ - Add Host/_Imports.razor for Razor component usings - Make MapCentralUI generic: MapCentralUI<TApp>() accepts root component - Add AdditionalAssemblies to discover CentralUI's pages/layouts - Routes.razor references both Host and CentralUI assemblies - Fix all DI registrations (TemplateEngine services) - SCADALINK_CONFIG env var for role-specific config loading Verified: blazor.web.js HTTP 200 (200KB), login page renders with Blazor interactive server mode, SignalR circuit establishes, LDAP auth works.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ScadaLink.TemplateEngine.Flattening;
|
||||
using ScadaLink.TemplateEngine.Services;
|
||||
using ScadaLink.TemplateEngine.Validation;
|
||||
|
||||
namespace ScadaLink.TemplateEngine;
|
||||
|
||||
@@ -9,6 +12,25 @@ public static class ServiceCollectionExtensions
|
||||
services.AddScoped<TemplateService>();
|
||||
services.AddScoped<SharedScriptService>();
|
||||
|
||||
// Flattening services (stateless utilities)
|
||||
services.AddTransient<FlatteningService>();
|
||||
services.AddTransient<DiffService>();
|
||||
services.AddTransient<RevisionHashService>();
|
||||
|
||||
// Validation services (stateless utilities)
|
||||
services.AddTransient<ScriptCompiler>();
|
||||
services.AddTransient<SemanticValidator>();
|
||||
services.AddTransient<ValidationService>();
|
||||
|
||||
// Domain services (depend on scoped DbContext / repositories)
|
||||
services.AddScoped<InstanceService>();
|
||||
services.AddScoped<SiteService>();
|
||||
services.AddScoped<AreaService>();
|
||||
services.AddScoped<TemplateDeletionService>();
|
||||
|
||||
// Note: CycleDetector, CollisionDetector, LockEnforcer, and TemplateResolver
|
||||
// are static utility classes and do not require DI registration.
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user