AgentHostExtensions.AddAgentMiddleware 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 an IMiddleware instance to be used by the CloudAdapter pipeline. Can be called multiple times to add additional middleware in order.
public static Microsoft.Extensions.Hosting.IHostApplicationBuilder AddAgentMiddleware(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, Microsoft.Agents.Builder.IMiddleware middleware);
static member AddAgentMiddleware : Microsoft.Extensions.Hosting.IHostApplicationBuilder * Microsoft.Agents.Builder.IMiddleware -> Microsoft.Extensions.Hosting.IHostApplicationBuilder
<Extension()>
Public Function AddAgentMiddleware (builder As IHostApplicationBuilder, middleware As IMiddleware) As IHostApplicationBuilder
Parameters
- builder
- IHostApplicationBuilder
The host application builder.
- middleware
- IMiddleware
The middleware instance to add.
Returns
The same builder for chaining.
Remarks
Middleware registered here runs in the adapter pipeline (before AgentApplication routing). Each call appends to an internal list that is resolved as IMiddleware[] by the CloudAdapter constructor.