Startup.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Microsoft.AspNetCore.Builder;
  2. using Microsoft.AspNetCore.Hosting;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Microsoft.Extensions.Configuration;
  5. using Microsoft.Extensions.DependencyInjection;
  6. namespace Did.NetcoreLoader.Demo
  7. {
  8. public class Startup
  9. {
  10. public Startup(IConfiguration configuration)
  11. {
  12. Configuration = configuration;
  13. }
  14. public IConfiguration Configuration { get; }
  15. // This method gets called by the runtime. Use this method to add services to the container.
  16. public void ConfigureServices(IServiceCollection services)
  17. {
  18. services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
  19. }
  20. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  21. public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  22. {
  23. if (env.IsDevelopment())
  24. {
  25. app.UseDeveloperExceptionPage();
  26. }
  27. else
  28. {
  29. app.UseHsts();
  30. }
  31. app.UseHttpsRedirection();
  32. app.UseMvc();
  33. }
  34. }
  35. }