You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using LinqToDB.Common;
|
|
using LinqToDB.Data;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using trainav.web;
|
|
using trainav.web.database;
|
|
|
|
DataConnection.DefaultSettings = new Database.Settings();
|
|
|
|
Migrations.RunMigrations();
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddRazorPages();
|
|
builder.Services.AddSession(options => {
|
|
options.IdleTimeout = TimeSpan.MaxValue;
|
|
options.Cookie.HttpOnly = true;
|
|
options.Cookie.IsEssential = true;
|
|
});
|
|
|
|
#if (DEBUG)
|
|
builder.Services.AddControllers().AddRazorRuntimeCompilation();
|
|
builder.Services.AddControllers();
|
|
#else
|
|
builder.Services.AddControllers();
|
|
#endif
|
|
|
|
var 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.UseSession();
|
|
app.UseRouting();
|
|
app.UseAuthorization();
|
|
|
|
app.UseEndpoints(endpoints => {
|
|
endpoints.MapRazorPages();
|
|
endpoints.MapControllers();
|
|
});
|
|
|
|
app.Run();
|