2881099 / csredis

.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
MIT License
2.01k stars 414 forks source link

连接到Azure Cache for Redis 异步方法报错 #161

Open Itoktsnhc opened 5 years ago

Itoktsnhc commented 5 years ago
var connStr = "example.com:6380,password=pwd,ssl=True,testcluster=false"
var conn = new CSRedis.CSRedisClient(connStr)
await conn.SetAsync("Name", "Val");//这一步会等待一段时间,然后报错超时

其中 await conn.SetAsync("Name", "Val"); 这一步会等待一段时间,然后报错超时。

System.IO.IOException HResult=0x80131620 Message=Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Source=System.Net.Sockets StackTrace: at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Security.SslStreamInternal.FillBufferAsync[TReadAdapter](TReadAdapter adapter, Int32 minSize) at System.Net.Security.SslStreamInternal.d__341.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ValueTaskAwaiter1.GetResult() at System.Net.Security.SslStreamInternal.Read(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Security.SslStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.IO.BufferedStream.ReadByteSlow() at System.IO.BufferedStream.ReadByte() at CSRedis.Internal.IO.RedisReader.ReadType() in C:\Users\Itokt\Downloads\Compressed\csredis-master\csredis-master\src\Internal\IO\RedisReader.cs:line 21

Inner Exception 1: SocketException: A connection attempt failed because the connected party did not properly >respond after a period of time, or established connection failed because connected host has >failed to respond

image

但是连接本地:127.0.0.1:6379 可以正常使用的。 同步方法可以正常使用。

2881099 commented 5 years ago

https://github.com/2881099/csredis/issues/130 看下这个,目前 SocketEventArgs 对 ssl 操作不友好

Itoktsnhc commented 5 years ago

@2881099 了解了,多谢😁