Startup.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Microsoft.AspNetCore.Builder;
  2. using Microsoft.AspNetCore.Hosting;
  3. using Microsoft.AspNetCore.HttpsPolicy;
  4. using Microsoft.Extensions.Configuration;
  5. using Microsoft.Extensions.DependencyInjection;
  6. using Microsoft.Extensions.Hosting;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Threading.Tasks;
  11. namespace GuestName
  12. {
  13. public class Startup
  14. {
  15. public Startup(IConfiguration configuration)
  16. {
  17. Configuration = configuration;
  18. }
  19. public IConfiguration Configuration { get; }
  20. // This method gets called by the runtime. Use this method to add services to the container.
  21. public void ConfigureServices(IServiceCollection services)
  22. {
  23. services.AddControllersWithViews();
  24. }
  25. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  26. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  27. {
  28. if (env.IsDevelopment())
  29. {
  30. app.UseDeveloperExceptionPage();
  31. }
  32. else
  33. {
  34. app.UseExceptionHandler("/Home/Error");
  35. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  36. app.UseHsts();
  37. }
  38. app.UseHttpsRedirection();
  39. app.UseStaticFiles();
  40. app.UseRouting();
  41. app.UseAuthorization();
  42. app.UseEndpoints(endpoints =>
  43. {
  44. endpoints.MapControllerRoute(
  45. name: "default",
  46. pattern: "{controller=Home}/{action=Index}/{id?}");
  47. });
  48. }
  49. }
  50. }