My CosmosDB emulator works well when tested locally with a console application.
I want to connect from my Xamarin Android application, be it on the emulator or on a device on the same LAN. If with the emulator I connect to https://10.0.2.2:8081 with the CosmosDB client, in the debug console I see many repeated:
[0:] DocDBTrace Warning: 0 :
[0:] Endpoint not reachable. Refresh cache and retry
If with the emulator, with the browser, I connect to https://10.0.2.2:8081/_explorer/index.html I can access the DataExplorer.
I understood that I have to enable the /AllowNetworkAccess, so I shut down the emulator, deleted the CosmosDBEmulator data folder, and then:
.\Microsoft.Azure.Cosmos.Emulator.exe /GenKeyFile=cosmo.key
and then launched with
.\Microsoft.Azure.Cosmos.Emulator.exe /AllowNetworkAccess /KeyFile=cosmo.key
DataExplorer opens, and I try to create a db, but I receive this error:
So basically with /AllowNetworkAccess I receive an error even with its own web based DataExplorer, used locally.
I tried my app from the Android emulator, using the cosmos.key new key, and I get this error:
Microsoft.Azure.Cosmos.CosmosException: 'Response status code does not indicate success: Unauthorized (401); Substatus: 0; ActivityId: 626ab064-6c6e-445a-883a-8491de96636f; Reason: (Response status code does not indicate success: Unauthorized (401); Substatus: 0; ActivityId: 626ab064-6c6e-445a-883a-8491de96636f; Reason: (Response status code does not indicate success: Unauthorized (401); Substatus: 0; ActivityId: 626ab064-6c6e-445a-883a-8491de96636f; Reason: (Message: {"Errors":["The MAC signature found in the HTTP request is not the same as the computed signature. Server used following string to sign - 'post\ndocs\ndbs/localPlayGround/colls/containerPlayGround\nthu, 05 nov 2020 15:28:15 gmt\n\n'. Learn more: https://aka.ms/cosmosdb-tsg-mac-signature"]} ActivityId: 626ab064-6c6e-445a-883a-8491de96636f, Request URI: /apps/DocDbApp/services/DocDbServer1/partitions/a4cb494d-38c8-11e6-8106-8cdcd42c33be/replicas/1p/, RequestStats: RequestStartTime: 2020-11-05T15:28:15.8263417Z, RequestEndTime: 2020-11-05T15:28:15.8403436Z, Number of regions attempted:1 ResponseTime: 2020-11-05T15:28:15.8403436Z, StoreResult: StorePhysicalAddress: rntbd://192.168.0.6:10253/apps/DocDbApp/services/DocDbServer1/partitions/a4cb494d-38c8-11e6-8106-8cdcd42c33be/replicas/1p/, LSN: 2, GlobalCommittedLsn: -1, PartitionKeyRangeId: , IsValid: True, StatusCode: 401, SubStatusCode: 0, RequestCharge: 0, ItemLSN: -1, SessionToken: -1#2, UsingLocalLSN: True, TransportException: null, ResourceType: Document, OperationType: Query , SDK: Microsoft.Azure.Documents.Common/2.11.0, Please see CosmosDiagnostics, Linux/Unknown cosmos-netstandard-sdk/3.14.0);););'
Any suggestion on what am I doing wrong? CosmosDB Emulator is 2.11.6
Thanks