ASP.NET Core 2.1复制时出现Hangfire错误

问题描述 投票:1回答:1

我使用kubernetes StatefulSet作为gke kubernetes中的hangfire吊舱。除进行复制外,它运行正常。由于防伪令牌验证,我收到此异常:

Microsoft.AspNetCore.Antiforgery.Internal.DefaultAntiforgery [7]反序列化令牌时引发异常。Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException:防伪令牌可以不被解密。 ---> System.Security.Cryptography.CryptographicException:密钥在钥匙圈中找不到{9f4f1619-10ff-4283-a529-eb48a0799815}。

请问有什么解决方法吗?

asp.net-core kubernetes asp.net-core-2.0 hangfire
1个回答
0
投票

响应是对持久化数据保护密钥的重做

var redis = ConnectionMultiplexer.Connect("localhost,password=password");

services.AddDataProtection()
        .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
© www.soinside.com 2019 - 2024. All rights reserved.