Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

60 řádky
1.9 KiB

  1. using Microsoft.AspNetCore.Builder;
  2. using Microsoft.AspNetCore.HttpsPolicy;
  3. using Microsoft.AspNetCore.Hosting;
  4. using Microsoft.AspNetCore.ResponseCompression;
  5. using Microsoft.Extensions.Configuration;
  6. using Microsoft.Extensions.DependencyInjection;
  7. using Microsoft.Extensions.Hosting;
  8. using System.Linq;
  9. namespace MQTTnet.Test.BlazorApp.Server
  10. {
  11. public class Startup
  12. {
  13. public Startup(IConfiguration configuration)
  14. {
  15. Configuration = configuration;
  16. }
  17. public IConfiguration Configuration { get; }
  18. // This method gets called by the runtime. Use this method to add services to the container.
  19. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
  20. public void ConfigureServices(IServiceCollection services)
  21. {
  22. services.AddControllersWithViews();
  23. services.AddRazorPages();
  24. }
  25. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  26. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  27. {
  28. if (env.IsDevelopment())
  29. {
  30. app.UseDeveloperExceptionPage();
  31. app.UseWebAssemblyDebugging();
  32. }
  33. else
  34. {
  35. app.UseExceptionHandler("/Error");
  36. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  37. app.UseHsts();
  38. }
  39. app.UseHttpsRedirection();
  40. app.UseBlazorFrameworkFiles();
  41. app.UseStaticFiles();
  42. app.UseRouting();
  43. app.UseEndpoints(endpoints =>
  44. {
  45. endpoints.MapRazorPages();
  46. endpoints.MapControllers();
  47. endpoints.MapFallbackToFile("index.html");
  48. });
  49. }
  50. }
  51. }