如何解决取消保护会话cookie的错误

时间:2019-04-23 13:11:42

标签: c# asp.net-core

我收到以下警告,AFAIK这与Cookie和GDPR有关,请CMIIW。

该如何解决?需要帮忙.. 提前非常感谢

问候 唐

    public void ConfigureServices(IServiceCollection services)
    {
        services.Configure<CookiePolicyOptions>(options =>
        {
            options.CheckConsentNeeded = context => true;
            options.MinimumSameSitePolicy = SameSiteMode.None;
        }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
        ...
        ... 
        app.UseStaticFiles();
        app.UseCookiePolicy();
  

[WRN]取消保护会话cookie时出错。       System.Security.Cryptography.CryptographicException:在密钥环中找不到密钥{833d40c6-95a9-4d70-9f1c-b5024726a65c}。          在Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte [] protectedData,Boolean allowOperationsOnRevokedKeys,UnprotectStatus&status)          在Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte [] protectedData,Boolean ignoreRevocationErrors,Boolean&requireMigration,Boolean&wasRevoked)          在Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte [] protectedData)          在Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector保护器,String protectedText,ILogger记录器)

0 个答案:

没有答案