Language

BotApplication.ProcessAsync(HttpContext, CancellationToken) Method

Definition

Processes an incoming HTTP request containing a bot activity.

public virtual System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken = default);
abstract member ProcessAsync : Microsoft.AspNetCore.Http.HttpContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.ProcessAsync : Microsoft.AspNetCore.Http.HttpContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function ProcessAsync (httpContext As HttpContext, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

httpContext
HttpContext

The HTTP context containing the incoming bot activity request.

cancellationToken
CancellationToken

A cancellation token that can be used to cancel the initial deserialization. Note: a dedicated timeout governs activity processing.

Returns

A task that represents the asynchronous activity processing operation.

Exceptions

Thrown if the request body cannot be deserialized into a valid activity.

Thrown if an error occurs while processing the activity, wrapping the original exception and the offending CoreActivity.

Remarks

The request body is deserialized into a CoreActivity, run through the registered middleware pipeline (see UseMiddleware(ITurnMiddleware)), and finally dispatched to OnActivity.

A dedicated internal timeout (configurable via ProcessActivityTimeout, default 5 minutes) is used instead of the HTTP request's cancellation token, because streaming handlers may outlive the original HTTP connection. When a debugger is attached the timeout is disabled.

Applies to