2016-11-07 39 views
5

Azure Search .Net SDK kullanıyorum.Bir görev iptal edildi - bu ne anlama geliyor?

böyle (NOT ASYNC) işlevi, bir senkron çağırıyorum: Genellikle çalışır

var searchResults = searchIndexClient.Documents.Search<T>(searchText, searchParameters); 

. Ben herhangi bir zaman uyumsuz işlevleri kullanarak değilim, ama nedense hata sadece bir zaman uyumsuz hata gibi görünüyor var: Arama tamamlanmadan önce

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

CancellationToken: IsCanceleationRequested=false 

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

StackTrace: 

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable 1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Search.DocumentsOperations.<DoContinueSearchWithHttpMessagesAsync>d__15 3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable 1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Search.DocumentsOperationsExtensions.<SearchAsync>d__15 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter 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, List 1 searchFields, SearchMode searchMode, List 1 select, Nullable 1 skip, Nullable 1 top, String filter, Boolean includeTotalResultCount, List 1 orderBy) in c:\Projects\MyAppServer\src\MyApp.AzureSearch\AzureSearchService.cs:line 262 at MyApp.AzureSearch.AzureSearchService.SearchEmails(Guid userId, String origin, String searchText, Nullable 1 skip, Nullable 1 top, Boolean includeTotalResultCount, Boolean includeHtmlBody, Boolean orderByProcessedAscending, String interactionStatus) in c:\Projects\MyAppServer\src\MyApp.AzureSearch\AzureSearchService.cs:line 167 at MyApp.Domain.MyAppMessages.Command.MyAppMessagesAllNoticedUpdater.Handle(VisitorSession userSession, NoticeAllMyAppMessages processCommand) in c:\Projects\MyAppServer\src\MyApp.Domain\MyAppMessages\Command\MyAppMessagesAllNoticedUpdater.cs:line 30

cevap

3

Büyük olasılıkla, istemci zaman aşımı süresi doldu. Özellikle karmaşık bir sorgu gönderdiğinizde bu hatayı görüyor musunuz? Gerekirse, search traffic analytics'u kullanarak hizmetinizdeki arama performansına bakabilirsiniz.

"Eşzamansız" bir istisna gördüğünüzün nedeni, API'nin eşzamanlı sürümünün yalnızca eşzamansız ilkellerin üzerindeki bir sarmalayıcı olmasıdır.

+0

Teşekkürler, bir async işlevi sarmayı düşündüm. Hiç de karmaşık bir sorgu değildi ve sorguda da çok az veri yoktu. Sorguda bir şey yanlış yapılandırılmadıkça .net SDK'nın bir hata atmasını beklemiyordum. Kullanması gereken .net sdk tarafından atılabilecek tüm olası hataların bir listesi var mı? – richard

+0

Atılabilecek temel istisnalar şunlardır: "CloudException", "IndexBatchException" (yalnızca indeksleme için), "ValidationException" ve tabii ki "OperationCanceledException" (veya onun alt sınıfı olan TaskCanceledException ile burada uğraşırken). Ancak C#, kontrol edilen bir istisna dili olmadığından, diğer istisnaları da görebilirsiniz (ArgumentException gibi). –