-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
35 lines (28 loc) · 1.04 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.AspNetCore.Components.WebAssembly.Services;
using personal_website.Components;
using personal_website.Services;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
var hostBaseAddress = builder.HostEnvironment.BaseAddress;
var httpClient = new HttpClient { BaseAddress = new Uri(hostBaseAddress) };
builder.Services.AddScoped(sp => httpClient);
// Add Security Service
builder.Services.AddScoped<SecurityService>();
// Configure lazy loading
builder.Services.AddScoped<LazyAssemblyLoader>();
try
{
var host = builder.Build();
// Resolve SecurityService and configure security
var securityService = host.Services.GetRequiredService<SecurityService>();
securityService.ConfigureHttpClientSecurity();
await host.RunAsync();
}
catch (Exception ex)
{
Console.WriteLine($"Application startup error: {ex}");
throw;
}