今天用C# 连接Redis做性能测试,用的接口是StackExchange.Redis,按照正常的思路获取数据库连接,代码如下:

1             string conn = "我的ip:6379,password=登录密码";
2
3             ConnectionMultiplexer client = ConnectionMultiplexer.Connect(conn);
4
5             IDatabase db = client.GetDatabase(2);

然后就向里边添加数据,类似的代码如下:

1                 RedisKey key ="1";
2
3                 RedisValue value = "....";
4
5                 this.db.SetAdd(key, value);

弄完以后用Redis-cli连接Redis,命令是:

redis-cli -h 192.168.1.XXX -p 6379 -a 登录密码

登录成功以后用get的方式获取如:get 1,发现报错:WRONGTYPE Operation against a key holding the wrong kind of value,到网上看看有说值重复的说啥的都有,后来检查代码发现我添加数据的时候用的是this.db.SetAdd(key, value);这句的意思是向集合中添加代码的,后来修改成 this.db.StringSet(key, value);就一切正常了

本来就是一个非常基础的问题查啊查,还以为是key值或value值出现特殊字符造成的呢,查了半天,如果以后有兄弟遇到像我一样的问题不妨去看看你的类型是不是有问题,对了当时用get的时候报错,用smembers 1 都能出来值已经很明显那个是一个集合了,新手兄弟们一起吸取教训啊,老鸟们别嫌我说话烦啊,这个不是给老手看的

转载于:https://www.cnblogs.com/Taburensheng/p/6170821.html

c# 连接Redis报错:WRONGTYPE Operation against a key holding the wrong kind of value:类型搞混弄出的错误...相关推荐

  1. redis报错WRONGTYPE Operation against a key holding the wrong kind of value

    具体错误: WRONGTYPE Operation against a key holding the wrong kind of value; nested exception is redis.c ...

  2. RedisTemplate报错WRONGTYPE Operation against a key holding the wrong kind of value

    场景 今天写业务代码,先从redis中读取值,不存在的话加redis锁,锁定之后再次尝试读取一次redis,没有值的话去db中读取并写redis缓存. 非常简单的代码,确报错WRONGTYPE Ope ...

  3. redis操作报错——WRONGTYPE Operation against a key holding the wrong kind of value

    背景介绍 今天在操作redis的时候,突然遇到遇到以下错误 原因分析 尝试一:刚看到这个错误的时候,我第一意识是redis中没有key或者值,于是查了一下redis,发现是有这组值的. 果断查了资料发 ...

  4. redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value

    完整报错如下: (Python3.6) appleyuchi@ubuntu19:有序集合$ python example_of_range.py  Traceback (most recent cal ...

  5. Redis报错:WRONGTYPE Operation against a key holding the wrong kind of value 解决处理

    首先应该明白报这个错误说明了你用的jedis方法与redis服务器中存储数据的类型存在冲突. 例如:数据库中有一个key的数据存储的是Hash类型的,但是你使用jedis执行数据操作的时候却使用了非H ...

  6. Redis报错:WRONGTYPE Operation against a key holding the wrong kind of value;解决办法

    异常收集 原因1: 原因2: 总结:仰天大笑出门去,我辈岂是蓬蒿人 往redis存入Map时出错提示:WRONGTYPE Operation against a key holding the wro ...

  7. redis: WRONGTYPE Operation against a key holding the wrong kind of value

    redis: WRONGTYPE Operation against a key holding the wrong kind of value 原因:因为redis中已经存在了相同的key 解决办法 ...

  8. redis redisson 分布式锁 WRONGTYPE Operation against a key holding the wrong kind of value

    在使用redisson加锁的时候报错如下 trylock WRONGTYPE Operation against a key holding the wrong kind of value 错误场景: ...

  9. Redis 之 WRONGTYPE Operation against a key holding the wrong kind of value【bug解决】

    问题描述: 生产环境redis 查询出错,排查原因才发现,在做login记录缓存到redis,发现有两处地方,set key 时同名了,导致在get key  获取  导致出错! 如下,你在" ...

最新文章

  1. 【Qt】使用QPalette设置按钮颜色时,不生效
  2. 使用Git上传项目到码云仓库
  3. 人工智能:第八章 自动规划
  4. 《云栖精选》第8期:科技,改变世界
  5. linux安装mysql5.6
  6. Lynis 检测自身安全漏洞工具(本机)
  7. es6html模板,js 字符串模板 ES6
  8. linux内核配置重置,linux内核配置--Boot options
  9. UIApplication
  10. viper4android ddc,蝰蛇音效v4a音效最新版
  11. 打印图片显示选择传真调制器或服务器,选择打印时为什么显示发送传真
  12. 移植sqlite3到arm-linux上(AM3352)
  13. 基于Vue的移动端图片裁剪组件 vue-clip(完美兼容ios与安卓)
  14. linux下把文件夹压缩成tar.gz的命令
  15. 使用富盛Sbo-Addon程序开发框架轻松开发模态单据选择查询功能实例
  16. Hive操作——复制表结构和数据
  17. Grafana自定义报警
  18. iOS 内存五大区讲解
  19. java windows wifi密码_windows10 通过命令行来查看wifi密码
  20. C++ 实现文件夹复制

热门文章

  1. large_IPYi_09ef000018c21215
  2. 自定义控件:广告内容后期加载。以及NamingContainer层次的应用
  3. 有关scanf输入的问题
  4. 红黑树,看不懂你找我
  5. NEO从源码分析看nep2与nep6
  6. 新手福利:免费百页机器学习入门书
  7. 【SSH网上商城项目实战16】Hibernate的二级缓存处理首页的热门显示
  8. 互联网公司之外,银联等大型企业是如何玩转软件研发的?
  9. H5中JavaScript常用代码片段
  10. 【Android实战】记录自学自己定义GifView过程,能同一时候支持gif和其它图片!【有用篇】...