No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

Startup.cs 1.9 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. namespace MQTTnetServer
  7. {
  8. /// <summary>
  9. /// Web App Startup
  10. /// </summary>
  11. public class Startup
  12. {
  13. /// <summary>
  14. /// Constructor
  15. /// </summary>
  16. /// <param name="configuration"></param>
  17. public Startup(IConfiguration configuration)
  18. {
  19. var builder = new ConfigurationBuilder()
  20. .AddJsonFile("appsettings.json")
  21. .AddEnvironmentVariables();
  22. Configuration = builder.Build();
  23. }
  24. /// <summary>
  25. /// Application Settings
  26. /// </summary>
  27. public IConfigurationRoot Configuration { get; }
  28. /// <summary>
  29. /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  30. /// </summary>
  31. /// <param name="app"></param>
  32. /// <param name="env"></param>
  33. public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  34. {
  35. if (env.IsDevelopment())
  36. {
  37. app.UseDeveloperExceptionPage();
  38. }
  39. else
  40. {
  41. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  42. app.UseHsts();
  43. }
  44. app.UseHttpsRedirection();
  45. app.UseMvc();
  46. }
  47. /// <summary>
  48. /// This method gets called by the runtime. Use this method to add services to the container.
  49. /// </summary>
  50. /// <param name="services"></param>
  51. public void ConfigureServices(IServiceCollection services)
  52. {
  53. services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
  54. }
  55. }
  56. }