Reputation: 112
I am using the Microsoft.Web.Redis.RedisSessionStateProvider nuget package as the session store. We have an azure redis instance which is running currently in tls 1.0. I have added the below setting in the Application_Start() method to enable tls 1.2.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
I have bumped the tls version of redis to 1.2. But there is connection error. Is there something else i have to add in the web.config. My current web.config is below.
<sessionState timeout="20" mode="Custom" customProvider="MySessionStateStore">
<providers>
<!--<add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" connectionTimeoutInMilliseconds="5000" operationTimeoutInMilliseconds="1000" retrytimeoutInMilliseconds="5000" server="127.0.0.1" ssl="false" throwOnError="true" />-->
<add name="MySessionStateStore" port="6380" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="" accessKey="" ssl="true" connectionTimeoutInMilliseconds="5000" operationTimeoutInMilliseconds="1000" retrytimeoutInMilliseconds="5000" throwOnError="true" />
</providers>
</sessionState>
Upvotes: 4
Views: 3775
Reputation: 66
The only thing that you need to do is add sslprotocols=tls12 to your Redis connection string.
Example:
<sessionState mode="Custom" timeout="120" customProvider="RedisSessionProvider">
<providers>
<add type = "Microsoft.Web.Redis.RedisSessionStateProvider"
name = "RedisSessionProvider"
connectionString = "MyRedisConnection"/>
</providers>
</sessionState>
Note: Be sure that you have Microsoft.Web.Redis.RedisSessionStateProvider version 3.0.2 or later. Some references: https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-remove-tls-10-11
https://github.com/Azure/aspnet-redis-providers/wiki/Configuration
Upvotes: 5