无法使用Redis Om连接到redis服务器

f87krz0w  于 2022-12-09  发布在  Redis
关注(0)|答案(1)|浏览(212)

bounty将在5天后过期。回答此问题可获得+50的声誉奖励。ikramf90正在寻找来自声誉良好来源的答案:我想我缺少一个配置。请具体指出它。

我尝试用Redis OM连接到Redis示例,但出现了下面的错误。

The timeout was reached before the message could be written to the output buffer, and it was not sent, command=UNKNOWN, timeout: 5000, inst: 0, qu: 0, qs: 10, aw: False, bw: CheckingForTimeout, rs: ReadAsync, ws: Idle, in: 0, in-pipe: 0, out-pipe: 0, serverEndpoint: my-dev-redisServer.redis.server.windows.net:6380, mc: 1/1/0, mgr: 10 of 10 available, clientName: <My machiene name>, IOCP: (Busy=0,Free=1000,Min=12,Max=1000), WORKER: (Busy=0,Free=32767,Min=12,Max=32767), POOL: (Threads=6,QueuedItems=0,CompletedItems=65), v: 2.5.61.22961 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)
Failed on FT.CREATE ClassRoom -idx ON Hash PREFIX 1 ClassRoom SCHEMA Id TAG SEPARATOR | Persons TAG SEPARATOR |

我尝试设置最小线程数来解决这个问题,但它仍然抛出相同的错误。

[Document(StorageType = StorageType.Json, Prefixes = new[] { "ClassRoom" })]
public sealed class ClassRoom
{
    [RedisIdField][Indexed] public string Id { get; set; }
    [Indexed(JsonPath = "$.Id")] public List<Person> Persons { get; set; }
}

public class Person
{
    
    [Indexed] public int Id { get; set; }
    public String Name{ get; set; }
}

Connection string format :  redis://:password@host:portNumber

下面是与我的模型类似的示例模型。我使用HostedService方法创建索引,如下所述https://redis.io/docs/stack/get-started/tutorials/stack-dotnet/
谢谢你的帮忙!

cig3rfwq

cig3rfwq1#

首先,在连接字符串中将超时时间增加到15秒。

connectTimeout=15000&syncTimeout=15000

增加线程数(Program.cs或Startup.cs):

ThreadPool.SetMinThreads(workerThreads: 50, completionPortThreads: 50);

相关问题