I am setting up an API that fetches documents from azure cosmos DB..I havent access of particular azure portal and Having that Key and endpoint.while fetching documents from DB it causes task cancelling Exception.
Using the Key and Endpoint I fetches Database name and collections .While fetching document it cause error
Task was cancelled.
{“ClassName”:”System.AggregateException”,”Message”:”One or more errors occurred.”,”Data”:{},”InnerException”:{“ClassName”:”System.Threading.Tasks.TaskCanceledException”,”Message”:”A task was canceled.”,”Data”:{},”InnerException”:null,”HelpURL”:null,”StackTraceString”:null,”RemoteStackTraceString”:null,”RemoteStackIndex”:0,”ExceptionMethod”:null,”HResult”:-2146233029,”Source”:null,”WatsonBuckets”:null},”HelpURL”:null,”StackTraceString”:” at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)\r\n at Microsoft.Azure.Documents.Linq.DocumentQuery
1.d__c.MoveNext()\r\n at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source)\r\n at MobileApp1.Controllers.HealthController.GetAllCollections() in d:\Rijitha\10-APRIL-2019\SampleAzureCosmosMobileApp\SampleAzureCosmosMobileApp\MobileApp1\Controllers\HealthController.cs:line 95","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nGetResultCore\nmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Threading.Tasks.Task
1\nTResult GetResultCore(Boolean)”,”HResult”:-2146233088,”Source”:”mscorlib”,”WatsonBuckets”:null,”InnerExceptions”:[{“ClassName”:”System.Threading.Tasks.TaskCanceledException”,”Message”:”A task was canceled.”,”Data”:{},”InnerException”:null,”HelpURL”:null,”StackTraceString”:null,”RemoteStackTraceString”:null,”RemoteStackIndex”:0,”ExceptionMethod”:null,”HResult”:-2146233029,”Source”:null,”WatsonBuckets”:null}]}
DocumentClient client = new DocumentClient(new Uri(endpoint), authKey);
Microsoft.Azure.Documents.Database database = client.CreateDatabaseQuery(“SELECT * FROM d “).AsEnumerable().First();
collections = client.CreateDocumentCollectionQuery((String)database.SelfLink).ToList();
documentlist = client.CreateDocumentQuery(UriFactory.CreateDocumentCollectionUri(“qualys”, “vuln_collection”), “select * from c”).ToList();
Need list of documents from collection