gpt4 book ai didi

c# - StackExchange.Redis 无法与 Mac OS X 中的 Mono 连接

转载 作者:IT王子 更新时间:2023-10-29 05:56:38 25 4
gpt4 key购买 nike

我正在尝试使用以下选项在 Mac OS X 的 Mono 上运行一个非常简单的 Redis 客户端:

var configOptions = new ConfigurationOptions() 
{
EndPoints =
{
{ "localhost", 6379 },
},
ResolveDns = true,
KeepAlive = 180
};
StringWriter sw = new StringWriter();
ConnectionMultiplexer.Connect(configOptions, tw);

连接失败。这是踪迹:

localhost:6379,keepAlive=180,resolveDns=True

Using DNS to resolve 'localhost'...
'localhost' => 127.0.0.1
1 unique nodes specified
Requesting tie-break from 127.0.0.1:6379 > __Booksleeve_TieBreak...
Allowing endpoints 00:00:01 to respond...
127.0.0.1:6379 faulted: UnableToResolvePhysicalConnection on PING
127.0.0.1:6379 failed to nominate (Faulted)
> UnableToResolvePhysicalConnection on GET
No masters detected
127.0.0.1:6379: Standalone v2.0.0, master; keep-alive: 00:03:00; int: Connecting; sub: Connecting; not in use: DidNotRespond
127.0.0.1:6379: int ops=0, qu=0, qs=0, qc=1, wr=0, async=1, socks=2; sub ops=0, qu=0, qs=0, qc=0, wr=0, socks=1
Circular op-count snapshot; int: 0 (0.00 ops/s; spans 10s); sub: 0 (0.00 ops/s; spans 10s)
Sync timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
Starting heartbeat...

我尝试过使用和不使用 ResolveDNS 并直接指定 IP 地址。也尝试了几个端口。服务器正在运行并且可以通过 redis-cli 访问。

StackExchange.Redis version="1.0.289"targetFramework="net45"

Redis-64 2.8.9

更新

StackExchange.Redis version="1.0.297"targetFramework="net45", 同样的问题,不同的log

localhost:6666,keepAlive=180,resolveDns=True

Using DNS to resolve 'localhost'...
'localhost' => 127.0.0.1
1 unique nodes specified
Requesting tie-break from 127.0.0.1:6666 > __Booksleeve_TieBreak...
Allowing endpoints 00:00:05 to respond...
127.0.0.1:6666 faulted: UnableToResolvePhysicalConnection on PING
127.0.0.1:6666 failed to nominate (Faulted)
> UnableToResolvePhysicalConnection on GET
No masters detected
127.0.0.1:6666: Standalone v2.0.0, master; keep-alive: 00:03:00; int: Connecting; sub: Connecting; not in use: DidNotRespond
127.0.0.1:6666: int ops=0, qu=0, qs=0, qc=1, wr=0, async=1, socks=2; sub ops=0, qu=0, qs=0, qc=0, wr=0, socks=1
Circular op-count snapshot; int: 0 (0.00 ops/s; spans 10s); sub: 0 (0.00 ops/s; spans 10s)
Sync timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
resetting failing connections to retry...
retrying; attempts left: 2...
1 unique nodes specified
Requesting tie-break from 127.0.0.1:6666 > __Booksleeve_TieBreak...
Allowing endpoints 00:00:05 to respond...
127.0.0.1:6666 returned, but incorrectly
127.0.0.1:6666 failed to nominate (Faulted)
> UnableToResolvePhysicalConnection on GET
No masters detected
127.0.0.1:6666: Standalone v2.0.0, master; keep-alive: 00:03:00; int: Disconnected; sub: Connecting; not in use: DidNotRespond
127.0.0.1:6666: int ops=0, qu=0, qs=0, qc=1, wr=0, async=5, socks=3; sub ops=0, qu=0, qs=0, qc=0, wr=0, socks=2
Circular op-count snapshot; int: 0 (0.00 ops/s; spans 10s); sub: 0 (0.00 ops/s; spans 10s)
Sync timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
resetting failing connections to retry...
retrying; attempts left: 1...
1 unique nodes specified
Requesting tie-break from 127.0.0.1:6666 > __Booksleeve_TieBreak...
Allowing endpoints 00:00:05 to respond...
127.0.0.1:6666 returned, but incorrectly
127.0.0.1:6666 failed to nominate (Faulted)
> UnableToResolvePhysicalConnection on GET
No masters detected
127.0.0.1:6666: Standalone v2.0.0, master; keep-alive: 00:03:00; int: Disconnected; sub: Connecting; not in use: DidNotRespond
127.0.0.1:6666: int ops=0, qu=0, qs=0, qc=1, wr=0, async=8, socks=4; sub ops=0, qu=0, qs=0, qc=0, wr=0, socks=3
Circular op-count snapshot; int: 0 (0.00 ops/s; spans 10s); sub: 0 (0.00 ops/s; spans 10s)
Sync timeouts: 0; fire and forget: 0; last heartbeat: -1s ago

最佳答案

正如其他人所述,StackExchange.Redis 在连接到单声道服务器时出现问题,您必须从源代码构建自定义程序集,以单​​声道为目标。因此,我使用 monobuild.bash 从库的单声道构建创建了一个 nuget 包。您可以将其用作单声道上原始 StackExchange.Redis 的直接替代品。

https://www.nuget.org/packages/StackExchange.Redis.Mono/

由于我们在服务器应用程序中使用该包,因此我会定期更新它。

关于c# - StackExchange.Redis 无法与 Mac OS X 中的 Mono 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23871110/

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