Startup.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Masuit.Tools.Core.AspNetCore;
  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. using Microsoft.Extensions.Hosting;
  8. namespace NetCoreTest
  9. {
  10. public class Startup
  11. {
  12. public Startup(IConfiguration configuration)
  13. {
  14. Configuration = configuration;
  15. }
  16. public IConfiguration Configuration { get; }
  17. // This method gets called by the runtime. Use this method to add services to the container.
  18. public void ConfigureServices(IServiceCollection services)
  19. {
  20. services.AddStaticHttpContext();
  21. services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Latest);
  22. }
  23. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  24. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  25. {
  26. if (env.IsDevelopment())
  27. {
  28. app.UseDeveloperExceptionPage();
  29. }
  30. app.UseStaticHttpContext();
  31. app.UseMvcWithDefaultRoute();
  32. }
  33. }
  34. }