J
J
JackBoner2015-02-23 11:29:51
IIS
JackBoner, 2015-02-23 11:29:51

ASP.NET MVC 5 - Why is it automatically logged out?

There is a virtual hosting: IIS 8.5
Constantly there is an automatic exit from the account.
I use Identity 2.0, authorization through cookies.
The account is logged in with the rememberMe (IsPersistent) option, the cookies are not expired, the session timeout in the config is set quite large.
But every 5th minute of every hour, the application pool is restarted. The session is reset - all users are thrown out of the account.

So how do you stay logged in? Maybe I'm doing something wrong in the settings?
(ConfigAuth, SignInManager, CreateIdentity - everything is default there)

As I understand it, I cannot change the settings for the application pool cycle period, the hoster does not have such an option in the panel.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander S, 2015-02-23
@JackBoner

I haven’t worked with asp.net for a long time, but maybe it’s worth looking in the direction of saving sessions in the database, or at the level of the server itself, if only your site process is specifically restarted.
https://msdn.microsoft.com/en-us/library/ms178586(v=vs.140).aspx _

J
JackBoner, 2015-02-23
@JackBoner

Problem solved. It was not about the sessions that are reset when the pull is restarted.
I also wondered how sessions are related to Identity, which works through cookies.
In general, the point is in the machine key, which is responsible for the validation of cookies and sessions and which is generated anew, with each restart of the pool.
If you register it in the config, the problem will be solved. This will have to be done anyway if the application uses multiple servers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question