I've deployed a .Net Core web application to Azure App Service using Azure DevOps. Now, when I try to create file in 'D:\home\site\wwwroot' using Kudu it says:
409 Conflict: Could not write to local resource 'D:\home\site\wwwroot\anc' >due to error 'Could not find file 'D:\home\site\wwwroot\anc'.'.
I've noticed that the persmissions on the 'D:\home\site\wwwroot' directory are different than in a similar web app that I deployed using Publish Profile
Get-Acl result on the problematic app:
PS D:\home\site\wwwroot> Get-Acl "D:\home\site\wwwroot" Get-Acl "D:\home\site\wwwroot" Directory: D:\home\site Path Owner Access ---- ----- ------ wwwroot IIS APPPOOL\luncher-dev NT AUTHORITY\SYSTEM Allow FullControl...
Get-Acl result on other similar app:
PS D:\home\site\wwwroot> Get-Acl "D:\home\site\wwwroot" Get-Acl "D:\home\site\wwwroot" Directory: D:\home\site Path Owner Access ---- ----- ------ wwwroot BUILTIN\Administrators Everyone Allow DeleteSubdirectoriesAndFiles,...
Corresponding Release pipeline from Azure DevOps
How can I make the wwwroot directory writable?
Do not write
any file to wwwroot when you are in cloud. Because Azure can change your machine/server and thay will just move your publish gfiles. Not the files that you added after publish. So you will lost them.
When you deploy as zip you cannot edit the filesystem.
I didn’t know about this feature at all, and what is more, the setting is hidden in VSTS task so I didn’t notice it. You need to expand the Additional Deployment Options section and click on the Select deployment method checkbox, which is unchecked by default. Only after these two clicks, you can see the dropdown with deployment methods – ZipDeploy is the default one.
I needed to change it to use WebDeploy so the application files will be stored as normal files and the application can write in the filesystem like it could before.