Andrei Popescu
Andrei Popescu

Reputation: 65

Asp.Net Core 2.0 logging out after 30 seconds

I have an issue with production env (shared hosting): it keeps logging me out after 30 seconds, but on the development machine it works fine. I'm using identity SignInManager.

I've tried the following as suggested on github:

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

Upvotes: 2

Views: 671

Answers (2)

Ervis Trupja
Ervis Trupja

Reputation: 2800

Inside your Startup.cs file add the following:

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

You can check the details here.

Upvotes: 0

Andrei Popescu
Andrei Popescu

Reputation: 65

Apparently this was a memory issue. I've spoke with the hosting provider. The application pool memory was under 256MB.

Upvotes: 1

Related Questions