我创建了一个新的Azure CosmosDB(Gremlin API),然后下载了快速入门示例:

c# - Azure Cosmos DB快速入门示例不起作用-LMLPHP

当我运行它时,出现此异常:


  JsonReaderException:从JsonReader读取JObject时出错。路径'',第0行,位置0。


我检查了端点和authKey的设置。

    public async Task RunAsync(DocumentClient client)
    {
        // the line below throws the Exception
        Database database = await client.CreateDatabaseIfNotExistsAsync(new Database { Id = "graphdb" });

        DocumentCollection graph = await client.CreateDocumentCollectionIfNotExistsAsync(
            UriFactory.CreateDatabaseUri("graphdb"),
            new DocumentCollection { Id = "Persons" },
            new RequestOptions { OfferThroughput = 1000 });


c# - Azure Cosmos DB快速入门示例不起作用-LMLPHP

Quickstard示例带有在App.config文件中填充的终结点和authKey:
c# - Azure Cosmos DB快速入门示例不起作用-LMLPHP

怎么解决呢?

最佳答案

请将端点更改为此格式https://<account-name>.documents.azure.com:443/

这是新创建的Gremlin帐户的当前问题,很快就会在快速入门中得到解决。

关于c# - Azure Cosmos DB快速入门示例不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48169116/

10-13 07:58
查看更多