9
votes

I use Azure with node js App Service. When i try to delete empty folder using ftp or kudu app in node_modules folders i get error: 409 Conflict: Cannot delete directory. It is either not empty or access is not allowed. This folder is totally empty. How i can delete it?

5
Have you tried suggested solution of this issue from social.msdn.microsoft.com/Forums/security/en-US/… ?Abdul Rauf
yes and it not worksDarDev

5 Answers

15
votes

Check AppSettings of Web App and delete the setting ‘WEBSITE_RUN_FROM_PACKAGE’ or changing the setting value to 0.

0 - write mode; 1 - read-only mode

3
votes

All Azure Web Apps (as well as Mobile App/Services, WebJobs and Functions) run in a secure environment called a sandbox. Each app runs inside its own sandbox, isolating its execution from other instances on the same machine as well as providing an additional degree of security and privacy which would otherwise not be available. For more details, refer to this article.

For directory level access please refer the below:

Home directory access (d:\home):

Every Azure Web App has a home directory stored/backed by Azure Storage. This network share is where applications store their content. This directory is available for the sandbox with read/write access.

The sandbox implements a dynamic symbolic link in kernel mode which maps d:\home to the customer home directory. This is done to remove the need of the customer to keep referencing their own network share path when accessing the site. No matter where the site runs, or how many sites run on a VM, each can access their home directory using d:\home.

Local directory access (d:\local):

This is a temporary directory and can be deleted when no longer needed. This directory is a place to store temporary data for the application. The application naturally has read/write access to this directory.

Note that the d:\local folder in the scm site (where Kudu runs) is not the same as the one in the main site (where the web app runs). As a result, they cannot see each other's local files.

Incase if you haven’t tried this already, use the rmdir directoryname /s /q command in Kudu Console to delete the directory and see if that works.

You can also run this command from Web App console. To access, Goto Web app -> Development Tools -> Console

enter image description here

Hope this helps.

3
votes

There is a Process explorer tab in the header.

  1. Open Process explorer
  2. Kill the task that's using the folder or file
  3. You will be able to delete the folder in question

This is how I resolved the same issue.

1
votes

Here is my solution: adding this option to your step deploying to the app service. Hope it would help

Options for deploying

0
votes

You may use the command api to do that. Craft a CMD or PowerShell command that'll clean your wwwroot and then execute it.