We have a private .net app that runs on IIS windows server 2016. We are using the sessionstate service Forms authentication with cookies
When we recycle the apppool then any users are forced back to the login page. This is not the behaviour expected or wanted.
If we set up the same code on windows 10 we don't have that problem. We are struggling to replicate this in any other environment.
Is there some setting in IIS or else where that would affect this functionality ?
When I check the document, a possible is that identity of application pool will cause this issue. If identity of applocation pool is ApplicationPoolIdentity, nothing will happen. Only using custom account may happen. I think this is not accurate, but you can check the identity.
In IIS, you can change session state mode to keep user login even when application pool recycles.
Generally, IIS stores session state values and variables in memory on the local Web server. So you can use SQL Server Mode. SQL Server mode stores session state in a SQL Server database. Using this mode ensures that session state is preserved if the Web application is restarted, including application pool recycles, and also makes session state available to multiple Web servers in a Web farm.