ligershark / WebOptimizer

A bundler and minifier for ASP.NET Core
Apache License 2.0
750 stars 113 forks source link

Disk caching is not working when deploying the application using zip deploy #276

Open koljada opened 1 year ago

koljada commented 1 year ago

When I deploy my asp net 6 application using web deploy everything works fine. But when I deploy it using zip deploy disk caching is not working: I receive 500 errors for my static files. I had to set enableDiskCache to false to keep my production site running. I use AzureRmWebAppDeployment@4 azure devops task for deployment which by default use zip deploy and set following env variables: WEBSITE_RUN_FROM_PACKAGE=1 and WEBSITE_ENABLE_SYNC_UPDATE_SITE=true.

Is it not possible to use disk caching with zip deployment? If so, then I think it should be mentioned in docs

MatthewSteeples commented 6 months ago

While you can't write to the wwwroot folder, there are other folders that you can use on the App Service. See details for Windows (I'm not sure if there's a page for Linux deployments, but you can create files and folders in /tmp)

You can set the folder that the disk cache uses: WebOptimizerOptions.CacheDirectory in code or have a look at the main page for json.