mellamokb
Here are a few potential reasons and solutions.
Permission Issues- Sometimes, access permissions can change unexpectedly in Azure App Services. It's possible that the app no longer has the necessary permissions to access the ApplicationData folder. Double-check the app's permissions and ensure it still has access to this directory.
Azure App Service Sandbox Limitations- Azure App Services run apps in a restricted environment, and while there may not be any recent major changes, periodic platform updates could affect how certain system folders are accessed. It’s worth checking Azure App Service release notes for any updates that could be related to this issue.
Switch to Temporary Storage- Azure App Services provide full access to the D-\local\Temp directory. Instead of relying on ApplicationData, try using the temp directory for your caching needs-
string cachePath = Path.GetTempPath();
This folder is more stable and should work consistently in Azure App Services
Environment-Specific Behavior- Sometimes, changes between different environments (like staging or production) can cause unexpected behavior. Verify that the environment settings haven’t been modified in a way that impacts the retrieval of the Application Data path.
File System Changes After Restart- It's possible the file system gets cleared during an app restart or recycle, which can sometimes happen in Azure App Services. If this is the case, consider using persistent storage like Azure Blob Storage for caching, instead of relying on the local file system.
Store and retrieve settings and other app data Documentation URL: https://learn.microsoft.com/en-us/windows/apps/design/app-settings/store-and-retrieve-app-data