简体   繁体   中英

How to connect to remote Redis server by to UserName and Password

I want to connect to Redis to cache sessions I used Microsoft.Web.RedisSessionStateProvider I can't access the Redis server Because I have username and password Not the accessKey

I used this configuration

    <add name="RedisSessionStateStore"   applicationName="{App_}"  type="Microsoft.Web.Redis.RedisSessionStateProvider" 
            host="MyServerIp" port = "6379" accessKey="Password" ssl="false" />

here Exception is Error: NOAUTH Authentication required. Verify if the Redis password provided is correct.

then I edit configuration to

<add name="RedisSessionStateStore" applicationName="{jam2_}" type="Microsoft.Web.Redis.RedisSessionStateProvider" 
            connectionString="redis://username:'Password'@host" ssl="false" />

here Exception is UnableToConnect on rediss://username:'password'@host:6379/Interactive

The connectionString expects a StackExchange.Redis connection string , so in your case that would be:

<add name="RedisSessionStateStore" applicationName="{jam2_}" type="Microsoft.Web.Redis.RedisSessionStateProvider" 
            connectionString="host,password=Password,ssl=false" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM