XSRF令牌过期后,网站发布到IIS

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

我使用ASP.NET框架的样板,我把下面的代码中everypage。

@inject IAbpAntiForgeryManager AbpAntiForgeryManager

@{
    AbpAntiForgeryManager.SetCookie(Context);
}

我所说的应用服务如下:

var xhr = abp.services.app.order.add(data);

        xhr.done(function (data) {
            alert(data);
        });

一切工作正常,当我在本地主机上运行,​​即使我重建项目XSRF令牌将没有过期。当我点击[发布网站IIS]每到这时,所有的Ajax请求将返回400错误的请求,我想这是因为XSRF令牌过期,一切恢复正常后,我点击F5在浏览器中。这对用户很讨厌,什么东西我可以做些什么来防止这种错误?或自动刷新令牌?

谢谢!

更新

日志文件中的错误信息:

ERROR 2019-02-12 13:40:09,773 [71   ] .Antiforgery.Internal.DefaultAntiforgery - An exception was thrown while deserializing the token.
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted. ---> System.Security.Cryptography.CryptographicException: The key {996d31d2-0fa3-4ffe-8e82-e155c1486d33} was not found in the key ring.
asp.net asp.net-core aspnetboilerplate
1个回答
1
投票

基于错误,它听起来就像你的数据保护密钥已上发布旋转。点击这里,查看有关数据保护的文档:https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/introduction?view=aspnetcore-2.2。有一堆选项,如何配置它,在哪里存储密钥等你想改变它是如何将它们存储。

更多关于配置数据保护:https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-2.2

© www.soinside.com 2019 - 2024. All rights reserved.