Ingen beskrivning
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Startup.cs 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Builder;
  6. using Microsoft.AspNetCore.Hosting;
  7. using Microsoft.AspNetCore.HttpsPolicy;
  8. using Microsoft.Extensions.Configuration;
  9. using Microsoft.Extensions.DependencyInjection;
  10. using Microsoft.Extensions.Hosting;
  11. namespace RazorApp
  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.AddRazorPages();
  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("/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.MapRazorPages();
  45. });
  46. }
  47. }
  48. }