How to use redis ( with client certificate requirement ) for session state in asp.net 4.8

  Kiến thức lập trình
Hi Stackoverflow Team,

We are currently using Redis for session state and cache management along with SignalR, and everything is working fine 
because our current Redis server configuration allows connections without a client certificate(ssl=false option working).

However, we now have a new Redis server that requires a client certificate(ssl=true option) for connections. We have not found any way to specify certificate-related information in the web.config under the sessionState/providers node.

Note: we are able connect/read/write to redi cache with c# code and a client certificate(ssl=true option) for cache management,but issue with redis session state management.

We have used below technology & nuget package to implemented it:
1. .Net Framework 4.8
2. ASP.net MVC Version: 5.2.9 with C# 
3. StackExchange.Redis Version: 2.6.96
4. Redis Server Version: 7.2.3
5. Microsoft.AspNet.SessionState.SessionStateModule Version: 1.1.0.0

Our web config configuration is as below:

  <system.web>
    <compilation targetFramework="4.8" />
    <httpRuntime enableVersionHeader="false" targetFramework="4.8" maxRequestLength="2097151" executionTimeout="4800" maxQueryStringLength="32767" encoderType="System.Web.Security.AntiXss.AntiXssEncoder" />
    <sessionState timeout="60" mode="Custom" customProvider="MySessionStateStore">
      <providers>           
        <add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="redis-NNNNN.c264.ap-south-1-1.ec2.redns.redis-cloud.com:NNNNN" sslHost="redis-NNNNN.c264.ap-south-1-1.ec2.redns.redis-cloud.com" accessKey="<redis password>" ssl="true" retryTimeoutInMilliseconds="60000" throwOnError="true" operationTimeoutInMilliseconds="6000" clientCertPfx="Certificate/clientcertificate.pfx" clientCertPassword="<client ceritificate password>" />
      </providers>
    </sessionState>
  </system.web>  

Where NNNNN is the SSL port of redis endpoint.

We are facing below error:
"No connection is available to service this operation: EVAL"
Also attached same error screenshot
[enter image description here](https://i.sstatic.net/4DwsXqLj.png)

Any assistance to resolve this issue would be greatly appreciated

We have tried different option for ssl=true for Redis session state management options and as mentioned, we are able to connect/read/write to same redis server with ssl=true option using c# code for our cache management.

New contributor

Ashish Ahir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT