简体   繁体   中英

azure session and application pool recycle

I changed my session on my dev machine from InProc to SQL Server. One of the reasons I did this is that in case the application pool would recycle, I'd have the session available again on restart. Of course, the downside to a SQL session state is performance (at least compared to InProc).

If I move to Azure, do I 1) still need to worry about app pool recycles, 2) still consider SQL session as the best way to do it and 3) are there better options out there for Azure.

Thanks.

1) still need to worry about app pool recycles - YES. But you can configure the recycle interval. By default IIS recycle app pools every 22 hours I think

2) still consider SQL session as the best way to do it - YES. And no (look the next question)

3) are there better options out there for Azure. - Depends, but you may consider using Windows Azure AppFabric Cache for Session State.

Take a look at: http://www.nuget.org/List/Packages/System.Web.Providers for providers for SQL Azure. and http://msdn.microsoft.com/en-us/gg457897 for using Azure Appfabric Cache as Session State.

Edit: Considering limits for Azure AppFabric Cache , what I have confirmed for sure is that there is always one single connection for Azure AppFabric Cache from every azure instance.

Astaykov's answer is good. In addition, note that Windows Azure uses affinity-less load balancing, which means that in-proc really isn't an option. (I might have a session on one server, but when I load the next page, I may land on a different server that doesn't have that session.) You really need to store the session somewhere that's shared by all the servers. SQL or AF Cache are both good places.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM