简体   繁体   中英

Detect when IIS is recycling in Azure

I'm developing a WCF sercvice in Azure, in a web-role. I build an index in memmory, and use it to serve wcf request. My problem is that this index is gone from the memory after iis is recycling. Is there any way, to detect the recycling event, and copy the index to the memory again?

Thansk for your help.

Yes you can detect it in the Application_End event (in your Global.asax.cs).

The better solution would be not to put the index in memory. Since you're using a Web Role, you can use Windows Azure Caching (you won't need to pay extra for this). By using Windows Azure Caching you can store the index in memory, but not in the process of the application pool. It's still super-fast and it can survive application pool recycles.

Another advantage is that, when you store the index in Windows Azure Caching, all instances and roles in the same deployment will be able to use the same cache. This means they'll all use the same index you store in it.

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