MudBlazor
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
using MudBlazor.Services;
|
||||
using OI.Metrology.ClientHub.Data;
|
||||
using OI.Metrology.ClientHub.Models;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
|
||||
namespace OI.Metrology.ClientHub;
|
||||
|
||||
@ -8,34 +11,51 @@ internal class Program
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
AppSettings appSettings = Models.Binder.AppSettings.Get(builder.Configuration);
|
||||
|
||||
// Add services to the container.
|
||||
_ = builder.Services.AddRazorPages();
|
||||
_ = builder.Services.AddServerSideBlazor();
|
||||
|
||||
_ = builder.Services.AddSingleton(_ => appSettings);
|
||||
_ = builder.Services.AddSingleton<WeatherForecastService>();
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
LoggingLevelSwitch levelSwitch = new();
|
||||
LoggerConfiguration loggerConfiguration = new();
|
||||
// _ = loggerConfiguration.WriteTo.BrowserConsole();
|
||||
// _ = loggerConfiguration.MinimumLevel.ControlledBy(levelSwitch);
|
||||
// _ = loggerConfiguration.Enrich.WithProperty("InstanceId", Guid.NewGuid().ToString("n"));
|
||||
// _ = loggerConfiguration.WriteTo.BrowserHttp($"{apiUrl}ingest", controlLevelSwitch: levelSwitch);
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
Serilog.ILogger log = Log.ForContext<Program>();
|
||||
try
|
||||
{
|
||||
_ = 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();
|
||||
AppSettings appSettings = Models.Binder.AppSettings.Get(builder.Configuration);
|
||||
// Add services to the container.
|
||||
_ = builder.Services.AddRazorPages();
|
||||
_ = builder.Services.AddMudServices();
|
||||
_ = builder.Services.AddServerSideBlazor();
|
||||
|
||||
_ = builder.Services.AddSingleton(_ => appSettings);
|
||||
_ = builder.Services.AddSingleton<WeatherForecastService>();
|
||||
_ = builder.Services.AddScoped(serviceProvider => new HttpClient { BaseAddress = new Uri(appSettings.ApiUrl) });
|
||||
|
||||
WebApplication 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();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Fatal(ex, "An exception occurred while creating the WASM host");
|
||||
throw;
|
||||
}
|
||||
|
||||
_ = app.UseHttpsRedirection();
|
||||
|
||||
_ = app.UseStaticFiles();
|
||||
|
||||
_ = app.UseRouting();
|
||||
|
||||
_ = app.MapBlazorHub();
|
||||
_ = app.MapFallbackToPage("/_Host");
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user