C# MVC net.7 Application goes in time out

42 views Asked by At

I have created a web application in C# MVC net.7 that run on IIS windows server 2019 The program works well but after 30 mins the application times out.

In the Program.cs file I have tried the following:

builder.Services.AddSession(options =>
{
    options.IdleTimeout = TimeSpan.FromHours(14);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
});

When I tried it in debug it works well, but when I publish it still times out after 30 mins.

Any ideas? TY

1

There are 1 answers

0
Brando Zhang On BEST ANSWER

Where you store the user credential? Inside the cookie or session? Which authentication schema you have used? According to your description, it seesm the user credential expire which caused your application login again.

If you just want to know how to modify the IIS application pool idle time, you could refer to below steps:

Details, you could refer to below image:

1.Locate the application pool:

enter image description here

2.Modify the advanced settings.

enter image description here