In-Proc sessions in Azure hosted web app getting cleared

moshan Kulathunga 6 Reputation points
2021-07-16T04:35:52.483+00:00

In-Proc sessions in Azure-hosted web app getting cleared if continuously load the web app for about 5 to 10 mins. Once it starts happening it's likely to keep dropping sessions regularly for some time, then it starts to work again. Cannot find any app restarts or recycles during the time period. It seems like we might be hitting some sort of memory limit which kicks data out of the session cache, but cannot figure out what exactly causing to trigger this.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,920 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 18,366 Reputation points
    2021-07-16T12:26:13.49+00:00

    Thanks for asking question! InProc session mode indicates that session state is stored locally. This means that with InProc session state mode is stored as life objects in the App Domain of the Web application. This is why the session state is lost when Aspnet_wp.exe (or W3wp.exe, for applications that run on IIS) or the AppDomain restarts.

    To work around this problem, you can use StateServer or Configure SqlServer session state mode or Session state with Azure Redis cache. Also, as mentioned in the article, the best solution if you have to use session state is to use a cache provider, such as Session State Provider for Azure Cache.

    Further you may want to know that since you could scale up your web app to multiple instances, using In-Proc session mode is not a good practice for your to host your web app on Azure, which could not share session state between multiple instances of your web app.

    Also check this SO link here might helps.

    Let us know if further issue remains.

    0 comments No comments