来源:http://www.cnblogs.com/qtqq/p/5951201.html
Redis安装:http://www.runoob.com/redis/redis-install.html
Configuration:https://www.cnblogs.com/ArvinZhao/p/6007043.html
Redis可视化工具Redis Desktop Manager:https://redisdesktop.com/download
千万要记住,给Redis设置访问密码,Redis的连接字符串中也要设置好密码。
Redis设置密码:https://blog.csdn.net/qq_35357001/article/details/56835919
启动服务:dos中 cd Redis安装目录,运行 redis-server.exe redis.windows.conf;
启动命令:dos中 cd Redis安装目录,运行 redis-cli.exe -h 127.0.0.1 -p 6379;
设置密码:config set requirepass xsj10011 注意:密码尽量设置长一点
获取密码:config get requirepass 注意:获取密码之前需要先验证密码,不然获取不到
验证密码:auth xsj10011
密码改变之后,代码中的连接字符串里的密码也要对应改变,不然操作不了Redis。对应的可视化工具里的密码也要改。
1.打开VS的NuGet》搜索:StackExchange.Redis,安装到项目中
2.配置文件:
<appSettings>
<!-- 系统前缀 -->
<add key="redisKey" value="jay"/>
</appSettings>
<connectionStrings>
<!-- Redis连接字符串 -->
<add name="RedisExchangeHosts" connectionString="127.0.0.1:6379,allowadmin=true,password=xsj10011,keepAlive=180"/>
</connectionStrings>