the aspnet core data protection key stored in contentrootpath does not work on different machines

I have a solution to this problem. I found the answer here: https://techcommunity.microsoft.com/t5/iis-support-blog/system-security-cryptography-cryptographicexception-the-payload/ba-p/1919096

You have to call SetApplicationName when registering DataProtection:

services.AddDataProtection()
                .SetApplicationName("MyApp")
                .PersistKeysToFileSystem(new DirectoryInfo(keysfolder))

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top