簡體   English   中英

無法在 .net C# 中連接 AWS Redis 緩存 - RedisConnectionException: '沒有連接處於活動狀態/可用於服務此操作

[英]Unable to connect AWS Redis cache in .net C# - RedisConnectionException: 'No connection is active/available to service this operation

我在控制台中創建了 AWS ElasticCache - redisCache。 我想從 .net core/framework 應用程序訪問相同的內容 - 但無法連接相同的內容。

        ConfigurationOptions option = new ConfigurationOptions
        {
           AbortOnConnectFail = false,
           Ssl = true,
           ConnectTimeout =5000,
           KeepAlive = 2,
           EndPoints = { "xxxxxxxxxx.cache.amazonaws.com:6379" }
        };

        ConnectionMultiplexer redis = ConnectionMultiplexer.Connect(option);
        IDatabase db = redis.GetDatabase();
        string value = "abcdefg";
        db.StringSet("mykey", value);
        string getValue = db.StringGet("mykey");
        return getValue;

Gettitng 低於錯誤 -

StackExchange.Redis.RedisConnectionException:'沒有連接處於活動狀態/可用於服務此操作:SET mykey; UnableToConnect on xxxxx.cache.amazonaws.com:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, 未完成: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s,狀態:正在連接,mgr:10 個中的 10 個可用,最后一次心跳:從不,全局:5 秒前,v:2.2.88.56325,mc:1/1/0,mgr:10 個中的 10 個可用,clientName:machineId,IOCP:( Busy=0,Free=1000,Min=8,Max=1000), WORKER: (Busy=1,Free=32766,Min=8,Max=32767), v: 2.2.88.56325'

就我而言,問題與 DNS 有關。 (我正在使用 VPN 訪問 Redis)。 所以我所做的就是將谷歌 DNS 放在我的 wifi 連接中,這樣就成功了:

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM