Web deployment task failed (This access control list is not in canonical form and therefore cannot be modified)

Solution 1

I was able to solve this problem in the following way

  1. Go to IIS
  2. Right click on the website that you are publishing to and select Edit Permissions
  3. Click the Security tab.
  4. Click on Edit button
  5. A Message box will appear which tell that the Permission was not correctly ordered.
  6. Click Reorder on that message box.

enter image description here

Solution 2

Open the Command prompt (CMD) and execute the following two statements

icacls.exe C:\inetpub\wwwroot /verify /T /C /L /Q
icacls.exe C:\inetpub\wwwroot /reset /T /C /L /Q

note : Maybe you will want to open the CMD with Administrator privilege (Maybe I am not sure)

Cheers


You can run the following command to fix it

command prompt

icacls.exe C:\inetpub\wwwroot\<VIRTUAL DIRECTORY> /verify /T /C /L /Q
// If any entries are reported as being not in canonical order then run:
icacls.exe C:\inetpub\wwwroot\<VIRTUAL DIRECTORY> /reset /T /C /L /Q

Source

powershell

$path = C:\inetpub\wwwroot\<VIRTUAL DIRECTORY>
$acl = Get-Acl $path
Set-Acl $path $acl

Source