mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Created src folder, created docs folder, added Pflichtenheft
This commit is contained in:
49
src/Program.cs
Normal file
49
src/Program.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using ElmahCore;
|
||||
using ElmahCore.Mvc;
|
||||
using Serilog;
|
||||
using Berufsschule_HAM.Services;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Bind options
|
||||
builder.Services.Configure<LdapOptions>(builder.Configuration.GetSection("Ldap"));
|
||||
|
||||
// Register LDAP service as singleton (it manages its own connection)
|
||||
|
||||
|
||||
builder.Services.AddControllersWithViews();
|
||||
//builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(builder.Configuration)
|
||||
.CreateLogger();
|
||||
builder.Services.AddSerilog();
|
||||
|
||||
builder.Services.AddElmah<XmlFileErrorLog>(Options =>
|
||||
{
|
||||
Options.LogPath = builder.Configuration.GetValue<string>("Elmah:LogFolder") ?? "~/logs";
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton<LdapService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
}
|
||||
|
||||
app.UseElmah();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseRouting();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Assets}/{action=Index}/{id?}");
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user