2017-05-29 82 views
0

我們必須託管在Azure中的Redis的緩存,我們用以下的在我們的.NET的核心應用服務.NET核心應用:錯誤連接到Redis的託管在Azure上

services.AddSingleton<IConnectionMultiplexer>(provider => 
    ConnectionMultiplexer.Connect(Configuration.GetConnectionString("RedisConnection")) 
); 

我們的連接字符串類似以下幾點:

ourserver.redis.cache.windows.net:6380,password=******=,ssl=True,abortConnect=False,syncTimeout=4000 
從緩存中獲取我們不面對的問題,但如果我們再加上緩存我們有時會出現以下錯誤

"StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. ConnectTimeout"

我已經閱讀了如設置abortconnectfalse的解決方案,並增加了超時時間,但我已經像上面的連接字符串一樣實現了它。

如果您有任何建議或者您認爲我們對連接字符串有問題,請提供建議。

更新:我們實現了一個解決方案來解決連接問題,但現在我們得到這樣的:

StackExchange.Redis.RedisConnectionException: No connection is available to service this operation 

回答

0

你有什麼connectTimeout設置?你可以嘗試增加,看看它是否有幫助?

+0

請參閱上面的連接字符串。超時是4000 – Techy

+0

4000是你的syncTimout(這是你的操作超時)。還有另一個名爲「connectTimeout」的屬性,它是專門用於連接的超時值。如果你沒有改變它,它應該是5000(默認值) –

+0

非常感謝。請建議什麼是連接超時時間? – Techy

相關問題