任务被取消 - 这是什么意思?

ric*_*ard 6 asynchronous azure-cognitive-search azure-search-.net-sdk

我正在使用Azure Search .Net SDK.

我正在调用这样的同步(NOT ASYNC)函数:

var searchResults = searchIndexClient.Documents.Search<T>(searchText, searchParameters);
Run Code Online (Sandbox Code Playgroud)

它通常有效.我没有使用任何异步函数,但不知何故我刚刚得到的错误看起来像一个异步错误:

System.Threading.Tasks.TaskCanceledException: A task was canceled.

CancellationToken: IsCanceleationRequested=false

Task: Id = 556, Status = Canceled, Method = "{null}", Result = "{Not yet computed}"

StackTrace:
Run Code Online (Sandbox Code Playgroud)

在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)System.Runtime.CompilerServices.ConfiguredTaskAwaitable的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Search.DocumentsOperations.<DoContinueSearchWithHttpMessagesAsync>d__153.MoveNext()---来自之前的堆栈跟踪结束抛出异常的位置---在系统的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)的System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()处系统的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) .Runtime.CompilerServices.ConfiguredTaskAwaitable 1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Search.DocumentsOperationsExtensions.<SearchAsync>d__151.MoveNext()---抛出异常的前一个位置的堆栈跟踪结束---在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess上的System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()处System.Runtime.CompilerServices.TaskAwaite上System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)的(任务任务)r 1.GetResult() at Microsoft.Azure.Search.DocumentsOperationsExtensions.Search[T](IDocumentsOperations operations, String searchText, SearchParameters searchParameters, SearchRequestOptions searchRequestOptions) at MyApp.AzureSearch.AzureSearchService.PerformSearch[T](String searchText, SearchParameters searchParameters) in c:\Projects\MyAppServer\src\MyApp.AzureSearch\AzureSearchService.cs:line 359 at MyApp.AzureSearch.AzureSearchService.Search[T](String searchText, List1 searchFields,SearchMode searchMode,List 1 select, Nullable1 skip,Nullable 1 top, String filter, Boolean includeTotalResultCount, List1 orderBy)在c:\ Projects\MyAppServer\src\MyApp.AzureSearch\AzureSearchService.cs:第262行,位于MyApp.AzureSearch.AzureSearchService.SearchEmails(Guid userId,String origin, String searchText,Nullable 1 skip, Nullable1 top,Boolean includeTotalResultCount,Boolean includeHtmlBody,Boolean orderByProcessedAscending,String interactionStatus)在c:\ Projects\MyAppServer\src\MyApp.AzureSearch\AzureSearchService.cs:第167行,位于MyApp.Domain.MyAppMessages.Command.MyAppMessagesAllNoticedUpdater.在c:\ Projects\MyAppServer\src\MyApp.Domain\MyAppMessages\Command\MyAppMessagesAllNoticedUpdater.cs中处理(VisitorSession userSession,NoticeAllMyAppMessages processCommand):第30行

Eug*_*ets 5

最有可能的是,客户端超时在搜索完成之前已过期.提交特别复杂的查询时,您是否看到此错误?如果需要,您可以使用搜索流量分析查看服务中的搜索性能.

您看到"异步"异常的原因是API的同步版本只是异步原语的包装器.