AgentHostExtensions.AddAgentDefaults(IHostApplicationBuilder) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Registers default services required by the Agents SDK.
public static Microsoft.Extensions.Hosting.IHostApplicationBuilder AddAgentDefaults(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder);
static member AddAgentDefaults : Microsoft.Extensions.Hosting.IHostApplicationBuilder -> Microsoft.Extensions.Hosting.IHostApplicationBuilder
<Extension()>
Public Function AddAgentDefaults (builder As IHostApplicationBuilder) As IHostApplicationBuilder
Parameters
- builder
- IHostApplicationBuilder
The host application builder.
Returns
The same builder for chaining.
Remarks
This registers:
-
IHttpClientFactoryviaAddHttpClient()— used internally by the SDK for outbound HTTP calls (e.g., Bot Connector, token endpoints). - MVC Controllers via
AddControllers()— required for ASP.NET authorization services.
AddHttpClient() is idempotent and registers a default IHttpClientFactory. If you need named or typed clients (e.g., for custom DelegatingHandler pipelines or specific timeouts), register them separately via builder.Services.AddHttpClient("name", ...) — this does not conflict with the default registration.
If you need full control over HTTP client configuration for SDK internals, skip this method and use ServiceCollectionExtensions directly to register services manually.