简体   繁体   中英

ASP.Net Application cache in an Azure “Web App”

Sorry if this is a duplicate, but I am unable to find an answer to this question. I have a traditional ASP.Net website that I want to move from sinlge VM running IIS to an Azure "Web App". I frequently add and remove data from the application cache. If the the web app is running on multiple nodes, does azure have some clever mechanism for keeping the application cache in sync across all nodes? Or do i need to implement this myself?

If I do, is there a recommended mechanism to achieve this for azure web apps? I cant seem to find these answers anywhere.

You can use local cache, but that will be stored on the app service plan. So if you have your app on multiple app service plans, that wont work. (See https://docs.microsoft.com/en-us/azure/app-service/app-service-local-cache-overview ).

If you need to use a shared cache, azure offers redis. (see https://docs.microsoft.com/en-us/azure/redis-cache/cache-web-app-howto )

Adding to Verendus's comments. Quoting from documentation :

The home directory contains an app's content, and application code can write to it. If an app runs on multiple instances, the home directory is shared among all instances so that all instances see the same directory. So, for example, if an app saves uploaded files to the home directory, those files are immediately available to all instances.

Two examples of how App Service uses temporary local storage are the directory for temporary ASP.NET files and the directory for IIS compressed files. The ASP.NET compilation system uses the "Temporary ASP.NET Files" directory as a temporary compilation cache location. IIS uses the "IIS Temporary Compressed Files" directory to store compressed response output. Both of these types of file usage (as well as others) are remapped in App Service to per-app temporary local storage. This remapping ensures that functionality continues as expected.

Each app in App Service runs as a random unique low-privileged worker process identity called the "application pool identity", described further here: http://www.iis.net/learn/manage/configuring-security/application-pool-identities . Application code uses this identity for basic read-only access to the operating system drive (the D:\\ drive). This means application code can list common directory structures and read common files on operating system drive. Although this might appear to be a somewhat broad level of access, the same directories and files are accessible when you provision a worker role in an Azure hosted service and read the drive contents.

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