B List
B List

Reputation: 55

Verifying Redis in Azure for Session State in .NET

Using the steps here ASP.NET Session State Provider for Azure Redis Cache, I have set up session storage via Redis.

Though I set values in Session

Session["test1"] = "value1";

I don't see those tags in my Azure Redis cache, nor do I see any activity in "Hits and Misses".

I have checked the host string (validating that if I intentionally put in the wrong value that it complains)

Although it appears to work right now (I don't see any errors or exceptions), I'm looking for guidance on steps I could take to verify that I have Session State configured properly, and that is is not just using in-proc session state.

Note: I have also followed the steps to set up a more generic Redis cache How to Use Azure Redis Cache. This also appears to work but again I do not see any activity in the Azure Portal.

EDIT: Here is the web.config sessionState setting:

<sessionState mode="Custom" customProvider="MySessionStateStore">
  <providers>
    <add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="xxxtest1.redis.cache.windows.net" accessKey="xxxxxxxxx5PMkJNy4ZQFh86D+8c=" ssl="true" />
  </providers>

To check the tags I went to the azure portal, portlal.azure.com and looked at the Tags for my redis cache. Just for fun I added a couple of tags manually too and tried to retrieve them via the Session, but no go. var test1 = Session["dummy1"];

Upvotes: 0

Views: 879

Answers (1)

B List
B List

Reputation: 55

Using redis-cli, I can now see my values in the redis cache in Azure.

  1. Turn on Non-SSL port in Azure redis cache
  2. Run redis-cli, connecting to redis cache on Non-SSL port and get the values.

    C:\>redis-cli -h mytest1.redis.cache.windows.net -p 6379 -a McrqT....
    mytest1.redis.cache.windows.net:6379> get key1
    "test1"
    

Thanks to Brendan for pointing out that Tags are not what I was looking for, and to pranav for pointing out that I need to turn on the Non-SSL port for redis-cli.

Upvotes: 0

Related Questions