【问题标题】:Asp.Net Core 2.0 logging out after 30 secondsAsp.Net Core 2.0 30 秒后注销
【发布时间】:2018-09-05 16:11:03
【问题描述】:

我有一个生产环境(共享主机)的问题:它在 30 秒后一直让我退出,但在开发机器上它工作正常。我正在使用身份SignInManager

我已经按照 github 上的建议尝试了以下方法:

services.Configure<SecurityStampValidatorOptions>(options => options.ValidationInterval = TimeSpan.FromSeconds(10));
services.AddAuthentication()
        .Services.ConfigureApplicationCookie(options =>
        {
            options.SlidingExpiration = true;
            options.ExpireTimeSpan = TimeSpan.FromMinutes(30);
        });

【问题讨论】:

  • 您是否指定了超时可能在您的配置文件中。
  • @aman ASP.NET Core 中没有“配置文件”
  • @aman 这就是我上面建议的代码,但它不能解决问题
  • 如果您在浏览器中查看 cookie,您看到的过期时间是什么?另外,删除验证会影响这个吗?

标签: c# asp.net-core-2.0


【解决方案1】:

显然这是一个内存问题。我已经和托管服务提供商谈过了。应用程序池内存小于 256MB。

【讨论】:

    【解决方案2】:

    在您的 Startup.cs 文件中添加以下内容:

    ConfigureServices(IServiceCollection services)
    {
    //your code here
    services.AddDataProtection()
    .SetApplicationName("your-app-name")
    .PersistKeysToFileSystem(new DirectoryInfo("your-path-here"));
    //your code here
    }
    

    您可以查看details here.

    【讨论】:

    • 这不能回答问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-31
    • 2020-09-11
    • 2012-11-21
    • 2015-02-09
    • 1970-01-01
    相关资源
    最近更新 更多