.net - 无法通过 StackExchange.Redis 重新连接到 Azure Redis

标签 .net redis azure-web-app-service stackexchange.redis azure-redis-cache

警告:好吧,这是一个奇怪的地方,我不确定 SO 是否是正确的地方。

我有一个连接到 Azure Redis 缓存实例的 Azure 网站。 (使用 StackExchange.Redis)

一切都很好,然后有一天 - 网站无法连接到 Redis。

错误:

It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING

这是我的连接字符串:

mycache.redis.cache.windows.net,ssl=true,password=xxxxxx,syncTimeout=5000

这是我的诊断步骤:

  1. 尝试从本地连接到 Azure Redis。结果:成功(所以代码很好?)
  2. 尝试启动新的 Azure Redis 实例,从 Azure 连接。结果:失败(网站无法连接到任何 azure Redis 实例?)
  3. 启动新的 Azure 网站,其代码与错误代码相同,指向现有的 Redis 缓存。结果:成功(嗯,什么?)
  4. 归档新的 MVC 网站,添加 StackExchange.Redis,部署到新的 Azure 网站,连接到 Redis。结果:成功(所以 Redis 很好?)
  5. 将上述普通 MVC 网站部署到现有 Azure 网站(因此与 4 相同的代码,连接到相同的 Redis,唯一的区别是它使用旧的 Azure 网站物理机/网络)。结果:失败(wtf?)

那么 - 我认为 Redis 已将 Azure 网站“列入黑名单”? (这可能吗?)我知道客户端(我的代码)不会尝试并保持重新连接,但我已经多次退回该网站,它就是无法重新连接到 Redis .

事实告诉我,使用相同的代码连接到相同的 Redis 实例会成功启动一个新的 Azure 网站Azure/Redis 中出现某种黑名单/路由问题。

有什么想法吗?

编辑

问题似乎出在 Azure VNET 上。当我的网站属于 Azure 虚拟网络时,它无法连接到 Redis。但是当我将其从网络中取出时,它连接得很好。在今天之前,此设置运行良好。

所以我想知道 Azure 是否进行了更改,以便 VNET 中的网站无法连接到 Azure Redis? (我知道这毫无意义)

编辑 2:

附件是 Redis 连接尝试的日志。

Exception: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING connection-string-removed:6380,password=password-removed,ssl=True Connecting connection-string-removed:6380/Interactive... BeginConnect: connection-string-removed:6380 1 unique nodes specified Requesting tie-break from connection-string-removed:6380

__Booksleeve_TieBreak... Allowing endpoints 00:00:05 to respond... Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=4,Free=32763,Min=1,Max=32767) Not all tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=5,Free=32762,Min=1,Max=32767) connection-string-removed:6380 did not respond Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=5,Free=32762,Min=1,Max=32767) Not all tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=5,Free=32762,Min=1,Max=32767) connection-string-removed:6380 failed to nominate (WaitingForActivation) No masters detected connection-string-removed:6380: Standalone v2.0.0, master; keep-alive: 00:01:00; int: Connecting; sub: Connecting; not in use: DidNotRespond connection-string-removed:6380: int ops=0, qu=2, qs=0, qc=0, wr=0, socks=1; 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 connection-string-removed:6380 > __Booksleeve_TieBreak... Allowing endpoints 00:00:05 to respond... Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=6,Free=32761,Min=1,Max=32767) Not all tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=7,Free=32760,Min=1,Max=32767) connection-string-removed:6380 did not respond Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=7,Free=32760,Min=1,Max=32767) Not all tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=7,Free=32760,Min=1,Max=32767) connection-string-removed:6380 failed to nominate (WaitingForActivation) No masters detected connection-string-removed:6380: Standalone v2.0.0, master; keep-alive: 00:01:00; int: Connecting; sub: Connecting; not in use: DidNotRespond connection-string-removed:6380: int ops=0, qu=2, qs=0, qc=0, wr=0, async=3, socks=2; 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 connection-string-removed:6380 > __Booksleeve_TieBreak... Allowing endpoints 00:00:05 to respond... Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=8,Free=32759,Min=1,Max=32767) EndConnect: connection-string-removed:6380 (socket shutdown) Connect complete: connection-string-removed:6380 All tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=11,Free=32756,Min=1,Max=32767) connection-string-removed:6380 faulted: SocketFailure on PING Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=11,Free=32756,Min=1,Max=32767) Not all tasks completed cleanly, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=7,Free=32760,Min=1,Max=32767) connection-string-removed:6380 failed to nominate (WaitingForActivation) No masters detected connection-string-removed:6380: Standalone v2.0.0, master; keep-alive: 00:01:00; int: Connecting; sub: Connecting; not in use: DidNotRespond connection-string-removed:6380: int ops=0, qu=2, qs=0, qc=0, wr=0, async=7, socks=3; 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

有人能破译这个吗?

最佳答案

我来自 Azure Web Apps 团队 - 看起来您的 VNET 进入了一种特别奇怪的状态,并且正在中断您的应用程序的网络连接。我已修复此行为。

对于给您带来的不便,我们深感抱歉...

关于.net - 无法通过 StackExchange.Redis 重新连接到 Azure Redis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30906891/

相关文章:

.net - 仅在部署的PresentationFramework 中发生XmlParseException

arrays - Redis Lua 脚本 - 如何将数组作为参数传递给 nodejs 中的 Lua 脚本?

javascript - 从Redis返回数据仅在第二次有效

php - 是否可以为 Azure 上的 PHP Web 应用程序包含 web.config 文件(或等效文件)?

Azure 应用服务在应用服务的不同实例上给出了另一个响应

c# - 没有任何异常的应用程序崩溃

.net - .NET Framework 4客户端配置文件与.NET Framework 3.5客户端配置文件

node.js - 为什么每个人都使用 MongoDB 与 Node.Js 和 Express 进行用户身份验证

azure - 从 VisualStudio 发布的 WebJob 自动插入连接字符串

c# - Path.Combine 是否曾在 .net 中进行过网络调用?