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.