【问题标题】:ASP.NET Core 2.1 Hangfire error on replication复制时出现 ASP.NET Core 2.1 Hangfire 错误
【发布时间】:2020-02-17 23:48:28
【问题描述】:

我在 gke kubernetes 中使用 kubernetes StatefulSet 作为hangfire pod。除非我进行复制,否则它工作得很好。由于 Antiforgery 令牌验证,我得到了这个异常:

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】:

响应是 Persist DataProtection key to redis

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

services.AddDataProtection()
        .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");

【讨论】:

    猜你喜欢
    • 2019-05-06
    • 2019-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多