Startup.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.Extensions.Configuration;
  8. using Microsoft.Extensions.DependencyInjection;
  9. using Microsoft.Extensions.Logging;
  10. namespace Winsoft.GOV.XF.SPA.WXCore
  11. {
  12. public class Startup
  13. {
  14. public Startup(IHostingEnvironment env)
  15. {
  16. var builder = new ConfigurationBuilder()
  17. .SetBasePath(env.ContentRootPath)
  18. .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
  19. .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
  20. .AddEnvironmentVariables();
  21. Configuration = builder.Build();
  22. }
  23. public IConfigurationRoot Configuration { get; }
  24. // This method gets called by the runtime. Use this method to add services to the container.
  25. public void ConfigureServices(IServiceCollection services)
  26. {
  27. // Add framework services.
  28. services.AddMvc();
  29. }
  30. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  31. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  32. {
  33. loggerFactory.AddConsole(Configuration.GetSection("Logging"));
  34. loggerFactory.AddDebug();
  35. app.UseMvc();
  36. }
  37. }
  38. }