Files
agent-framework/dotnet/samples/AgentWebChat/AgentWebChat.Web/Program.cs
T
Reuben Bond 7967983755 Python: .NET: [BREAKING] Remove Actor-based runtime (#977)
* Remove Actor-based runtime

* Fix formatting

* Remove cosmos db vestigials

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2025-09-30 14:09:32 +00:00

50 lines
1.4 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using AgentWebChat.Web;
using AgentWebChat.Web.Components;
var builder = WebApplication.CreateBuilder(args);
// Add service defaults & Aspire client integrations.
builder.AddServiceDefaults();
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddOutputCache();
// This URL uses "https+http://" to indicate HTTPS is preferred over HTTP.
// Learn more about service discovery scheme resolution at https://aka.ms/dotnet/sdschemes.
Uri baseAddress = new("https+http://agenthost");
// for some reason does not resolve with `apiservice` url
Uri a2aAddress = new("http://localhost:5390/a2a");
builder.Services.AddHttpClient<AgentDiscoveryClient>(client => client.BaseAddress = baseAddress);
builder.Services.AddSingleton(sp => new A2AAgentClient(sp.GetRequiredService<ILogger<A2AAgentClient>>(), a2aAddress));
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseAntiforgery();
app.UseOutputCache();
app.MapStaticAssets();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.MapDefaultEndpoints();
app.Run();