Skip to content
This repository was archived by the owner on Oct 17, 2018. It is now read-only.
This repository was archived by the owner on Oct 17, 2018. It is now read-only.

An exception was thrown while deserializing the token.  #228

@Tratcher

Description

@Tratcher

From @1amirjalai on April 29, 2017 13:30

System.Security.Cryptography.CryptographicException: The key {xxxxxxxx} was not found in the key ring.

Im running asp.net core on a webfarm using redis as dataprotection.
after getting error like this from redis
Timeout performing EVAL, inst: 9, queue: 1448, qu: 0, qs: 1448, qc: 0, wr: 0, wq: 0, in: 65536, ar: 0, clientName: xxxx
i opt in to make redis thread safe using this code

   private static readonly Lazy<ConnectionMultiplexer> LazyConnection = new Lazy<ConnectionMultiplexer>(() =>
        {
        
           return ConnectionMultiplexer.Connect("xxxxxx,abortConnect=false,syncTimeout=3000");
        });

        public static ConnectionMultiplexer SafeCoonect
        {
            get
            {
                return LazyConnection.Value;
            }
        }

and initialize it in startup like :

      var redis = RedisConnectionManager.SafeCoonect;
         
                services
            .AddDataProtection()
          .PersistKeysToRedis(redis, "Key");

but now i get new error

The antiforgery token could not be decrypted. ---> System.Security.Cryptography.CryptographicException: The key {xxxxxxx} was not found in the key ring.

I'm also getting this warning :

Error unprotecting the session cookie.

what should i do?

Copied from original issue: aspnet/IISIntegration#363

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions