I'm trying to connect to an Azure Cosmos DB. I just followed Microsoft's tutorial, but I doesn't work.
client = new DocumentClient(new Uri ("<MY ENDPOINT>"),"<MY KEY>");
This seems to work, but when I try to do anything inside the database, it keeps throwing Json Parser exception.
await this.client.CreateDatabaseIfNotExistsAsync(new Database { Id = "DynamicForms" });
It throws the following error. I don't know If I am doing something wrong or is it really a bug.
at Newtonsoft.Json.JsonTextReader.ParseValue()\r\n
at Newtonsoft.Json.JsonTextReader.Read()\r\n
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)\r\n
at Microsoft.Azure.Documents.JsonSerializable.LoadFrom(JsonReader reader, JsonSerializerSettings serializerSettings)\r\n
at Microsoft.Azure.Documents.JsonSerializable.LoadFrom[T](JsonTextReader jsonReader, ITypeResolver1 typeResolver, JsonSerializerSettings settings)\r\n
1 locations, Func
at Microsoft.Azure.Documents.Client.ClientExtensions.CreateDocumentClientException(HttpResponseMessage responseMessage)\r\n
at Microsoft.Azure.Documents.Client.ClientExtensions.ParseResponseAsync(HttpResponseMessage responseMessage, JsonSerializerSettings serializerSettings)\r\n
at Microsoft.Azure.Documents.Client.GatewayServiceConfigurationReader.GetDatabaseAccountAsync(Uri serviceEndpoint)\r\n
at Microsoft.Azure.Documents.Routing.GlobalEndpointManager.GetDatabaseAccountFromAnyLocationsAsync(Uri defaultEndpoint, IList2 getDatabaseAccountFn)\r\n
1.<>c__DisplayClass1_0.<b__0>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at Microsoft.Azure.Documents.Client.GatewayServiceConfigurationReader.InitializeReaderAsync()\r\n
at Microsoft.Azure.Documents.Client.DocumentClient.InitializeGatewayConfigurationReader()\r\n
at Microsoft.Azure.Documents.Client.DocumentClient.GetInitializationTask()\r\n
at Microsoft.Azure.Documents.Client.DocumentClient.EnsureValidClientAsync()\r\n
at Microsoft.Azure.Documents.Client.DocumentClient.ReadDatabasePrivateAsync(String databaseLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance)\r\n
at Microsoft.Azure.Documents.BackoffRetryUtility
at Microsoft.Azure.Documents.BackoffRetryUtility1.ExecuteRetryAsync(Func
1 callbackMethod, Func3 callShouldRetry, Func
1 inBackoffAlternateCallbackMethod, TimeSpan minBackoffForInBackoffCallback, CancellationToken cancellationToken, Action1 preRetryCallback)\r\n
1.ExecuteRetryAsync(Func
at Microsoft.Azure.Documents.ShouldRetryResult.ThrowIfDoneTrying(ExceptionDispatchInfo capturedException)\r\n
at Microsoft.Azure.Documents.BackoffRetryUtility1 callbackMethod, Func
3 callShouldRetry, Func1 inBackoffAlternateCallbackMethod, TimeSpan minBackoffForInBackoffCallback, CancellationToken cancellationToken, Action
1 preRetryCallback)\r\n
at Microsoft.Azure.Documents.BackoffRetryUtility1.ExecuteAsync(Func
1 callbackMethod, IRetryPolicy retryPolicy, CancellationToken cancellationToken, Action`1 preRetryCallback)\r\n
at Microsoft.Azure.Documents.Client.DocumentClient.CreateDatabaseIfNotExistsPrivateAsync(Database database, RequestOptions options)\r\n
at POCVueNetCoreMongo.Connector.GenerateStructureAsync() in D:\Projetos\DynaForms\POCVueNetCoreMongo\Data\Connector.cs:line 29