Thursday, April 11, 2019

409 Conflict: Could not write to local resource 'D:\home\site\wwwroot\web.config' due to error 'Access to the path is denied.'.



Issues/Errors

409 Conflict: Could not write to local resource 'D:\home\site\wwwroot\web.config' due to error 'Access to the path is denied.'.

Not able to Delete and Stop continuous web jobs from Portal/Kudu.

Cause of the Issue

The above issues/errors occur when we are not allowed to perform any write operations on wwwroot folder.

The application setting ‘WEBSITE_RUN_FROM_PACKAGE=1’ of the App Service makes the wwwroot folder of the application as read-only.

If the setting is available in the application settings of the App Service then we will get 409 conflict error whenever we try to add/edit any files to the wwwroot folder from App Service Editor or Kudu console.





When Deleting/Stopping a web job, it tries to add a file disable.job file to the job folder. If the Web Job is deployed to App_Data folder of wwwroot folder of the application then adding of disable.job file to the job folder i.e. App_Data is not supported and hence web job delete/stop operation from Azure Portal/kudu will be unsuccessful.

When does the setting ‘WEBSITE_RUN_FROM_PACKAGE=1’ get added?

 Usually the setting is added when Run from package deployment is performed to App Service.

Run from Package deployment means application code will be available as a Zip deployment package in the d:\home\data\SitePackages (instead of wwwroot folder) and the zip gets mounted on wwwroot as a read-only file system.
Deploying from DevOps using App Service Deploy task version 4.0, if no deployment method is selected, it auto selects the best suitable deployment method based on the build artifact generated.

If the artifact generated is Zip file and App Service Deploy Task version is 4.0 then most probably it auto-select Run from Package deployment method (if no deployment method is selected manually) and add the setting ‘WEBSITE_RUN_FROM_PACKAGE=1’ making wwwroot folder as read-only.





More details about Run from package deployment can be found on the Url:

Solution

Deploy the application/web job using other deployment method i.e. MSDeploy, which change the setting value to 0 and make wwwroot folder writable.

Deleting the setting ‘WEBSITE_RUN_FROM_PACKAGE’ or changing the setting value to 0.

Note: Deleting the setting ‘WEBSITE_RUN_FROM_PACKAGE’ or changing the setting value to 0 implies the application code will now be pointed to wwwroot folder, so before changing the value to 0 make sure you  application code is not pointing to d:\home\data\SitePackages so as to avoid the situation where wwwroot folder end up having no files.


6 comments:

  1. Thank you. this error along with Filezilla not showing me the files was driving me crazy.

    ReplyDelete
    Replies
    1. yes, because you might be using Website_run_from_package=1, in that case, your files will be present in Sitepackage folder

      Delete
  2. yes, because you might be using Website_run_from_package=1, in that case, your files will be present in Sitepackage folder

    ReplyDelete
  3. Thanks for the article, really useful. Switching from 1 to 0 allowed on a test env allowed for a quick test to a config change.

    ReplyDelete
  4. El Dorado Resort Casino & Spa - MapYRO
    El Dorado Resort Casino & Spa 남원 출장안마 is a casino in El Dorado, California. The casino, 세종특별자치 출장샵 owned and operated by the Rincon Band of 안전 토토 사이트 Luiseno 제주도 출장안마 Indians, features 5500 slot Hotel highlights: Walking distance to El Dorado 충주 출장마사지 Resort Casino and Spa Rating: 7.5/10 · ‎3,060 reviews · ‎Price range: room rates from $32 per night (USD) - We Price Match!

    ReplyDelete

LinuxFx version has invalid values or while creating Linux app service plan using ARM template, it is creating as a window app service plan in app services

Due to latest changes in ARM API's, deployment for the Linux web app using the ARM template is failing with the below error's: ...