1
1

Startup.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Masuit.Tools.Core.AspNetCore;
  2. using Microsoft.AspNetCore.Builder;
  3. using Microsoft.AspNetCore.Hosting;
  4. using Microsoft.Extensions.Configuration;
  5. using Microsoft.Extensions.DependencyInjection;
  6. using Microsoft.Extensions.Hosting;
  7. namespace Masuit.Tools.Core.Test.AspNetCore
  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.AddResumeFileResult();
  20. services.AddMvc();
  21. }
  22. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  23. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  24. {
  25. if (env.IsDevelopment())
  26. {
  27. app.UseDeveloperExceptionPage();
  28. }
  29. app.UseRouting(); // 放在 UseStaticFiles 之后
  30. app.UseEndpoints(endpoints =>
  31. {
  32. endpoints.MapControllers(); // 属性路由
  33. endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); // 默认路由
  34. });
  35. }
  36. }
  37. }