得到错误超时在C#中使用StackExchange.Redis执行GET?

时间:2018-08-06 09:18:52

标签: c# asp.net-mvc redis

我已经创建了一个演示程序,并与StackExchange.Redis一起使用,用于使用带有c#的Asp.net mvc缓存某些值。但是我无法在本地系统中连接Redis缓存。 这是我的带有连接字符串的redis缓存类:

 public class RedisCache{
 private static readonly Lazy<ConnectionMultiplexer> _lazyConnection = new Lazy<ConnectionMultiplexer>(() => { return ConnectionMultiplexer.Connect("abv,password=63sd,ssl=True,abortConnect=False,allowAdmin=true"); });

    private static ConnectionMultiplexer _connection
    {
        get { return _lazyConnection.Value; }
    }
}

 public T Get<T>(string key, RedisDatabase database)
    {
        var result = default(T);
        var value = _connection.GetDatabase((int)database).StringGet(key);
        if (!value.IsNull)
        {
            result = JsonConvert.DeserializeObject<T>(value);
        }

        return result;
    }

当我运行我的代码时,我得到如下错误:

Timeout performing GET UserSearch, inst: 1, mgr: Inactive, err: never,             queue: 2, qu: 0, qs: 2, qc: 0, wr: 0, wq: 0, in: 0, ar: 0,
 clientName: Abc-PC, serverEndpoint: Unspecified/abv, keyHashSlot: 322, IOCP:
 (Busy=0,Free=1000,Min=4,Max=1000), WORKER:     (Busy=1,Free=32766,Min=4,Max=32767) (Please take a look at this article for    some common client-side 
 issues that can cause timeouts: http://stackexchange.github.io/StackExchange.Redis/Timeouts)

任何人都知道如何解决此错误,所以请您告诉我。

0 个答案:

没有答案