App forces user back to login when apppool recycles

JamesC222-1987 116 Reputation points
2020-12-30T09:57:50.14+00:00

We have a private .net app that runs on IIS windows server 2016. We are using the sessionstate service and Forms authentication with cookies

<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" timeout="10" />

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 ?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,346 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Bruce Zhang-MSFT 3,736 Reputation points
    2020-12-31T08:59:50.95+00:00

    Hi @JamesC222-1987 ,

    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.

    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.

    <configuration>  
      <system.web>  
        <sessionState mode="SQLServer"  
           sqlConnectionString="Integrated Security=SSPI;data   
           source=SampleSqlServer;" />  
     </system.web>  
    </configuration>  
    

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Bruce Zhang

    0 comments No comments