gpt4 book ai didi

redis - ConnectionMultiplexer.Connect 在连接到 Redis 服务器时中断

转载 作者:IT王子 更新时间:2023-10-29 06:00:02 24 4
gpt4 key购买 nike

我在我的 Windows 7 机器上成功安装了 Redis 服务器。快速动手,一切都按预期进行。(使用来自 https://github.com/MSOpenTech/redis 的 MSI 安装程序安装)

我正在使用 StackExchange redis 客户端 C# 连接到 Redis 服务器。
RedisClient

附言:我没有在我的机器上构建应用程序,因为我有 VS 2010,这会引发一些错误。所以我安装了 nuget 包,现在我在 C# 中的测试应用程序有程序集 StackExchange.Redis

enter image description here

我的控制台应用程序很简单,只有一行代码

    ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost:6379,allowAdmin=true");

它给了我一个错误:

System.AggregateException was unhandled
HResult=-2146233088
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout)
at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Func`1 multiplexerFactory, TextWriter log) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 817
at StackExchange.Redis.ConnectionMultiplexer.Connect(String configuration, TextWriter log) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 795
at testapp.Program.Main(String[] args) in D:\_Work\TestApp\Program.cs:line 64
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Security.VerificationException
HResult=-2146233075
Message=Method System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[System.Boolean].AwaitUnsafeOnCompleted: type argument 'Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[StackExchange.Redis.ServerEndPoint]' violates the constraint of type parameter 'TAwaiter'.
Source=StackExchange.Redis
StackTrace:
at StackExchange.Redis.ConnectionMultiplexer.<ReconfigureAsync>d__2d.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at StackExchange.Redis.ConnectionMultiplexer.ReconfigureAsync(Boolean first, Boolean reconfigureAll, TextWriter log, EndPoint blame, String cause, Boolean publishReconfigure, CommandFlags publishReconfigureFlags)
at StackExchange.Redis.ConnectionMultiplexer.<>c__DisplayClass29.<ConnectImpl>b__26() in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 815
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
InnerException:

最佳答案

对于偶然发现此问题的任何其他人,原因是与 Microsoft.Bcl 包的版本不匹配。运行命令Update-Package Microsoft.Bcl解决。

参见 http://blog.marcgravell.com/2014/03/so-i-went-and-wrote-another-redis-client.html?showComment=1405397410965#c8649668071319126908

关于redis - ConnectionMultiplexer.Connect 在连接到 Redis 服务器时中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36932701/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com