redis cache-对wsacancelblockingcall的调用中断了阻塞操作

b1zrtrql  于 2021-06-09  发布在  Redis
关注(0)|答案(0)|浏览(299)

我有一个asp.net web窗体页,其代码如下:

public partial class MyAspNetWebFormPage : System.Web.UI.Page{
   protected void Page_Load(object sender, EventArgs e){
      ClearRedisCache("RedisCacheConnectionString_01");
      ClearRedisCache("RedisCacheConnectionString_02");
   }

   private void ClearRedisCache(string redisConnectionString){
      var serverName = redisConnectionString.Split(',')[0];
      using (var redis = ConnectionMultiplexer.Connect(redisConnectionString)){
         var server = redis.GetServer(serverName);
         server.FlushAllDatabases(CommandFlags.None);
         redis.Close(true); // this was added as an effort to fix the problem but doesn't work

         // Another effort to make it work
         // Added after receiving the error
         do {
            Thread.Sleep(1000);
         } while (redis.IsConnected);
      }
   }
}

当我在本地的盒子上运行时,它似乎运行得非常好。但是,当我在我们的azure环境中运行它时,它会抛出一个异常,并显示以下消息:
对wsacancelblockingcall的调用中断了阻止操作
我看到的其他例子是缓存连接并保持其打开。这就是我要实现redis缓存的方式吗?
此代码从与使用者站点完全断开连接的管理 Jmeter 板执行。管理 Jmeter 板不使用redis缓存,只用于清除它。
任何想法都非常感谢。先谢谢你。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题