50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using AppLibs;
|
|
using AppLibs.Libs;
|
|
using ManagementApp.Models.Services;
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
|
|
|
await WSNavigation.LoadJson().ConfigureAwait(false);
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
//builder.Services.AddCors(o => o.AddPolicy(name: "allowOrigins",
|
|
// p => {
|
|
// p.WithOrigins("https://login.microsoftonline.com", "https://aadcdn.msftauth.net").SetIsOriginAllowed(o => true).AllowAnyHeader().AllowAnyMethod().AllowCredentials();
|
|
// })
|
|
//);
|
|
|
|
#if (!DEBUG)
|
|
builder.WebHost.UseKestrel(o =>
|
|
{
|
|
o.ListenAnyIP(5103, lo =>
|
|
{
|
|
lo.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
|
|
lo.UseHttps(CertificateStore.GetHTTPSCertificate("Cert/MApp.pfx"), "Pgq95b7r");
|
|
});
|
|
});
|
|
builder.Services.AddControllersWithViews();
|
|
#else
|
|
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
|
|
#endif
|
|
|
|
builder.Services.AddSingleton<Microsoft365Service>(s => new Microsoft365Service());
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Home/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.MapControllerRoute(
|
|
name: "default",
|
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
app.Run();
|