Startup.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. using Microsoft.Extensions.Hosting;
  7. using Microsoft.Extensions.Logging;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Threading.Tasks;
  12. using XYY.PerformanceCount.Standard;
  13. namespace PerformanceCountWebApi
  14. {
  15. public class Startup
  16. {
  17. public Startup(IConfiguration configuration)
  18. {
  19. Configuration = configuration;
  20. }
  21. public IConfiguration Configuration { get; }
  22. // This method gets called by the runtime. Use this method to add services to the container.
  23. public void ConfigureServices(IServiceCollection services)
  24. {
  25. services.AddPerformanceESDB(Configuration["DBConnectionStrings:ESUrl"]);
  26. services.AddControllers();
  27. }
  28. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  29. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  30. {
  31. if (env.IsDevelopment())
  32. {
  33. app.UseDeveloperExceptionPage();
  34. }
  35. app.UseStatusCodePages();
  36. app.UseHttpsRedirection();
  37. app.UseRouting();
  38. app.UseEndpoints(endpoints =>
  39. {
  40. endpoints.MapControllers();
  41. });
  42. }
  43. }
  44. }