Startup.cs 1.2 KB

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