【问题标题】:Failed after retried for 6 times in 30000 ms when accessing API with neo4j database使用neo4j数据库访问API时,30000毫秒内重试6次失败
【发布时间】:2021-08-22 05:07:32
【问题描述】:

最初,当我使用 neo4j 数据库访问 API 时,它可以正常工作,但一段时间后,当我尝试访问 API 时,出现以下错误:

Failed after retried for 6 times in 30000 ms. Make sure that your database is online and retry again.

我在 API 中使用下面的代码进行数据库连接:

var neo4jClient = new BoltGraphClient(new Uri(connectionUrl), Username, Password);
neo4jClient.ConnectAsync();
services.AddSingleton<IBoltGraphClient>(neo4jClient);

【问题讨论】:

    标签: asp.net-core neo4j graph-databases neo4jclient


    【解决方案1】:

    这里没有真正的编码答案,唯一让我印象深刻的是在neo4jClient.ConnectAsync() 调用之前缺少await

    除此之外,您还需要检查连接、网络等。如果它是本地的 - 那我不确定 - 我想你可以尝试/抓住这个 - 但这就是幕后发生的事情。

    【讨论】:

    • 如果我在 neo4jClient.ConnectAsync() 之前使用 await,则需要使 ConfigureServices() 方法异步。当我这样做时,授权服务会出现异常
    • 好吧,然后使用Wait - 如neo4jClient.ConnectAsync().Wait()
    • 我使用了 Wait - 就像在 neo4jClient.ConnectAsync().Wait() 中一样,但仍然出现问题中提到的错误
    • 您还有其他解决方案
    • 不,这不是代码问题 - 这是您的设置 - 它是本地数据库吗?防火墙?点击量有很多东西,它可能是
    猜你喜欢
    • 2019-08-19
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-01
    • 2019-08-29
    • 1970-01-01
    相关资源
    最近更新 更多