Authentication asp.net核心cookie身份验证无法正常工作

Authentication asp.net核心cookie身份验证无法正常工作,authentication,cookies,Authentication,Cookies,我已在asp.net core 2应用程序中配置了cookie身份验证, 以下是启动中的配置,cs文件 //1: services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options => {

我已在asp.net core 2应用程序中配置了cookie身份验证, 以下是启动中的配置,cs文件

 //1:
        services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
        .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme,
        options =>
        {
            //REF:https://tahirnaushad.com/2017/09/08/asp-net-core-2-0-cookie-authentication/
            //Cookie Authentication Options

            //Login View
            options.LoginPath = "/Account/Login";
            //Logout Action
            options.LogoutPath = "/Account/Logout";
            //Controls how much time the cookie will remain valid from the point it is created. 
            options.SlidingExpiration = true;
            //Ticket Expiration :represents the expiration of the ticket NOT the cookie that contains the ticket.
            //an expired cookie will be ignored even if it is passed to the server after the browser should have purged it.
            options.ExpireTimeSpan = TimeSpan.FromMinutes(10);
            //Cookie Expiration
            options.Cookie.Expiration = TimeSpan.FromMinutes(10);
            //override default name of cookie, which is .AspNetCore.Cookies
            options.Cookie.Name = "HDAPP1.0";
            //cookie can be accessed from client side scripts
            options.Cookie.HttpOnly = false;


            //ReturnUrlParameter = "returnUrl"
        });

        //2:
        services.AddAuthentication(options =>
        {
            options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
        });

        //3:add app.UseAuthentication(); in Configure Method

问题是滑动过期不起作用,应用程序总是在10分钟内注销,无论您是否在网站上工作。

您解决过这个问题吗?我有同样的问题。使用asp.net core 3.1对我来说完全是同样的问题