You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Program.cs 1.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using HelloAgents.Web;
  2. using HelloAgents.Web.Components;
  3. var builder = WebApplication.CreateBuilder(args);
  4. // Add service defaults & Aspire components.
  5. builder.AddServiceDefaults();
  6. // Add services to the container.
  7. builder.Services.AddRazorComponents()
  8. .AddInteractiveServerComponents();
  9. builder.Services.AddOutputCache();
  10. builder.Services.AddHttpClient<AgentAPIClient>(client =>
  11. {
  12. // This URL uses "https+http://" to indicate HTTPS is preferred over HTTP.
  13. // Learn more about service discovery scheme resolution at https://aka.ms/dotnet/sdschemes.
  14. client.BaseAddress = new("https+http://apiservice");
  15. });
  16. var app = builder.Build();
  17. if (!app.Environment.IsDevelopment())
  18. {
  19. app.UseExceptionHandler("/Error", createScopeForErrors: true);
  20. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  21. app.UseHsts();
  22. }
  23. app.UseHttpsRedirection();
  24. app.UseStaticFiles();
  25. app.UseAntiforgery();
  26. app.UseOutputCache();
  27. app.MapRazorComponents<App>()
  28. .AddInteractiveServerRenderMode();
  29. app.MapDefaultEndpoints();
  30. app.Run();