accessing a cosmosdb from asp.net core mvc deployed in web app for container
error is
DocumentClientException: Entity with the specified id does not exist in the system.
Code
var cosmosAccount = await azure.CosmosDBAccounts.GetByResourceGroupAsync(model.ResourceGroupName, model.CosmosDBNameAccount);
model.IPRangeFilter = cosmosAccount.IPRangeFilter.Split(',').ToList();
var endpointUrl = "*********";
var authorizationKey = "*****************";
using(var client = new DocumentClient(new Uri(endpointUrl), authorizationKey)){
var document = await client.ReadDocumentAsync(UriFactory.CreateDocumentUri(model.Database, model.Collection, "1"));
model.SampleDataFromDB.Add((Models.CosmosDB.SampleDataFromDB)(dynamic)document.Resource);
}
This code works without any issue from localhost but when this is deployed to azure in web app for container it is intermittently failing with error DocumentClientException: Entity with the specified id does not exist in the system. it works sometimes.
can you please help in understanding why this occurs
accessing a
cosmosdb
from asp.net core mvc deployed inweb app for container
error isCode
This code works without any issue from
localhost
but when this is deployed to azure inweb app for container
it is intermittently failing with errorDocumentClientException: Entity with the specified id does not exist in the system.
it works sometimes.can you please help in understanding why this occurs