VSERVERWS/Program.cs
Cameron Taylor 6bc14b88c9 Initial Commit.
New site in .NET 6 replacing .net framwk 4.8
2022-07-27 16:02:36 -04:00

45 lines
1.0 KiB
C#

//ZXING.dll does not copy properly to publish folder, copy manually from another lib, ie cvrlib-nf.
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddControllers().AddJsonOptions((options => {
//was changing PRINTER_NAME to printeR_NAME (pascal Case: https://github.com/dotnet/runtime/issues/30887)
options.JsonSerializerOptions.PropertyNamingPolicy = null;
}));
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();
}
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapControllers();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
VSERVERWS.Global.Globals.LoadPrinters();