【发布时间】:2021-01-29 13:46:44
【问题描述】:
我有一个网络作业不断将数据插入 redis 我还有另一个时间触发功能,可以每隔 5 分钟从同一个 redis 缓存中读取数据。
public static void ProcessData([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer)
{
var newCacheclient = new RedisCacheClient(Program.spRedisCacheConnectionPoolMgr, Program.serializer, Program.redisConfiguration).Db0;
var cachedData = newCacheclient.GetAsync<List<MyObject>>("mydata").Result;
执行 10-15 分钟后,时间触发功能出现错误。有人知道如何解决这个问题吗?
InvalidOperationException: 读取后不允许读取 完成。
我也向 github 提出了同样的问题。
错误堆栈 - 内部异常 1:
InvalidOperationException: Reading is not allowed after reader was completed.
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at MyData.Functions.ExecuteTrade(TimerInfo myTimer) in C:\Users\\Functions.cs:line 27
at Microsoft.Azure.WebJobs.Host.Executors.VoidMethodInvoker`1.InvokeAsync(TReflected instance, Object[] arguments)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.<InvokeAsync>d__0.MoveNext()
at System.IO.Pipelines.ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed()
at System.IO.Pipelines.Pipe.AdvanceReader(SequencePosition& consumed, SequencePosition& examined)
at System.IO.Pipelines.Pipe.DefaultPipeReader.AdvanceTo(SequencePosition consumed, SequencePosition examined)
at StackExchange.Redis.PhysicalConnection.<ReadFromPipe>d__110.MoveNext() in /_/src/StackExchange.Redis/PhysicalConnection.cs:line 1495
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at StackExchange.Redis.Extensions.Core.Implementations.RedisDatabase.<GetAsync>d__14`1.MoveNext()
【问题讨论】:
-
您使用的 StackExchange.Redis nuget 版本是什么?另请分享完整的堆栈跟踪。
-
使用 nuget 详细信息更新问题,请检查谢谢
标签: c# azure c#-4.0 redis stackexchange.redis