问题
I have moved my WebApp to the Azure App Service Environment and have enabled the new LocalCache option as documented at https://azure.microsoft.com/en-us/documentation/articles/app-service-local-cache/
However, the environment variable that is supposed to tell you that the cache is ready does not exist.
If I use Kudo and go to Process Explorer, Click on properties for the w3wp (without the scm label) process, then click on Environment Variables the only variables I see are:
WEBSITE_LOCAL_CACHE_OPTION Always
APPSETTING_WEBSITE_LOCAL_CACHE_OPTION Always
WEBSITE_LOCAL_CACHE_SIZEINMB 1000
APPSETTING_WEBSITE_LOCAL_CACHE_SIZEINMB 1000
WEBSITE_LOCALCACHE_ENABLED True
But not the one I need:
WEBSITE_LOCALCACHE_READY
I am stuck as to what is happening; can anyone give any ideas for me to try?
回答1:
Local Cache is a feature which is not currently enabled in App Service Environment.
回答2:
The correct answer here is this:
As the documentation you referenced mentioned:
How can I tell if my site has switched to using Local Cache?
If you're using the Local Cache feature with Staging Environments, the swap operation does not complete until Local Cache is warmed up. To check if your site is running against Local Cache, you can check the worker process environment variable WEBSITE_LOCALCACHE_READY. Use the instructions on the worker process environment variable page to access the worker process environment variable on multiple instances.
You stated: If I use Kudo and go to Process Explorer, Click on properties for the w3wp (without the scm label) process, then click on Environment Variables the only variables I see are:
WEBSITE_LOCAL_CACHE_OPTION Always APPSETTING_WEBSITE_LOCAL_CACHE_OPTION Always WEBSITE_LOCAL_CACHE_SIZEINMB 1000 APPSETTING_WEBSITE_LOCAL_CACHE_SIZEINMB 1000 WEBSITE_LOCALCACHE_ENABLED True
This environment variable WEBSITE_LOCALCACHE_READY is part of the "Worker Process", not the host process w3wp.exe
You need to get a memory dump of the worker process as outlined here: https://github.com/projectkudu/kudu/wiki/Process-Threads-list-and-minidump-gcdump-diagsession#process-environment-variable
Start with:
GET /api/processes/0 => detail process information of scm site's w3wp.exe. Or use -1 for main site. https://(kudu-site).scm.azurewebsites.net/api/processes/0 (Shows the w3wp.exe process)
The "main site" is the worker process. https://(kudu-site).scm.azurewebsites.net/api/processes/-1
This shows a full process dump, in the contents you will see your variable: "WEBSITE_LOCALCACHE_ENABLED":"True","WEBSITE_LOCALCACHE_READY":"TRUE"
I have this running in an ASEv2 as well, so I don't think the comment earlier from cory-fowler that this isn't supported in an ASE is correct. Maybe it was when he wrote it, but currently it is supported.
来源:https://stackoverflow.com/questions/36459551/azure-localcache-not-setting-the-ready-environment-variable-on-ase