Azure App Service with Local Storage: Files Not Persisting After Restart
I'm performance testing and I can't seem to get This might be a silly question, but Hey everyone, I'm running into an issue that's driving me crazy. I'm experiencing issues with file persistence in my Azure App Service. I have a web application running on .NET Core 3.1, and I'm using the local storage feature to temporarily save user-uploaded files. However, after the app service restarts (which seems to happen quite frequently), all the files in the local storage are lost. I expected that files stored in the `D:\home\site\wwwroot\uploads` directory would persist across restarts. I've confirmed that I am writing to the correct path. Here is the code snippet where I save the uploaded files: ```csharp public async Task<IActionResult> UploadFile(IFormFile file) { if (file.Length > 0) { var uploads = Path.Combine(Directory.GetCurrentDirectory(), "uploads"); if (!Directory.Exists(uploads)) { Directory.CreateDirectory(uploads); } var filePath = Path.Combine(uploads, file.FileName); using (var stream = new FileStream(filePath, FileMode.Create)) { await file.CopyToAsync(stream); } return Ok(); } return BadRequest(); } ``` I've also tried using the `D:\local\temp` directory, but I face the same issue. I read that Azure App Services use a form of ephemeral storage, so I'm not sure if I'm missing something in my configuration. I would appreciate any insights on how to ensure files persist even after the app service restarts. Are there any recommended practices or alternative approaches I should consider for handling file uploads in Azure App Services? This is part of a larger API I'm building. I've been using C# for about a year now. Thanks, I really appreciate it! This is happening in both development and production on Linux. Thanks for any help you can provide! I'm working with C# in a Docker container on Linux. Any help would be greatly appreciated!