Program.cs 844 B

12345678910111213141516171819202122232425262728293031
  1. using HallOfFame;
  2. using Microsoft.EntityFrameworkCore;
  3. var builder = WebApplication.CreateBuilder(args);
  4. // Add services to the container.
  5. builder.Services.AddControllersWithViews();
  6. builder.Services.AddDbContext<PersonDBContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
  7. var app = builder.Build();
  8. // Configure the HTTP request pipeline.
  9. if (!app.Environment.IsDevelopment())
  10. {
  11. app.UseExceptionHandler("/Home/Error");
  12. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  13. app.UseHsts();
  14. }
  15. app.UseHttpsRedirection();
  16. app.UseStaticFiles();
  17. app.UseRouting();
  18. app.UseAuthorization();
  19. app.MapControllerRoute(
  20. name: "default",
  21. pattern: "{controller=Home}/{action=Index}/{id?}");
  22. app.Run();