Azure DocumentDB Owner Resource Does Not Exist

I have the same error icrosoft.Azure.Documents.DocumentClientException: Message: {"Errors": ["Resource owner does not exist"]}, this is my script. When I deployed my webapp to Azure and tried to get some document from docDb, it throws this error. Docdb exists in azure and contains the document I'm looking for.

The strange thing is that from my local machine (running from VS) this works fine. I use the same settings in Azure and local. Someone has an idea about this.

thank

+6
source share
4 answers

Resource owner does not exist

happens when you specify an invalid database name.

, client.readDocument(..), DocumentClient, , docLink, .

+10

. , Visual Studio 2017 Release . Release CosmosDB, , " " Azure. .

+2

, //, . , , , .

, , -

var response = await client.ReadDocumentAsync(UriFactory.CreateDocumentUri(database, collection, "documentid"));

try catch, , , , Microsoft .

- .

                Model myDoc = null;

                try
                {
                    var response = await client.ReadDocumentAsync(UriFactory.CreateDocumentUri(database, collection, document));
                    myDoc = (Model )(dynamic)response.Resource;
                }
                catch { }


                if (myDoc != null)
                {
                   //do your work here
                }

, , , .

, , : https://github.com/DamianStanger/DocumentDbDemo

Azure DocumentDB

+1
source

I saw the same error when filling out documents in DB space. Updating the CosmosDB account solved the problem.

0
source

Source: https://habr.com/ru/post/1675380/


All Articles