Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Web App Deployment error via msdeploy - ERROR_INSUFFICIENT_A CCESS_TO_SITE_FOLDER

I have been deploying to my Azure Web App for about 4 months now, using msdeploy, and everything has been smooth sailing to upload the website. Until recently, there has been no errors with deployment. I now receive a "ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER" error when publishing the website application.

The only way for me to successfully update the website is stop the Web App on Azure, then execute a Publish for the Web Application via Visual Studio. But this can be an issue if users are currently using the system. I don't really want any downtime while updating the website.

The full error is as follows:

msdeploy error ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER: Web deployment task failed. (Unable to perform the operation ("Create File") for the specified directory ("D:\home\site\ wwwroot\bin\Domain.DbFactory.dll"). This can occur if the server administrator has not authorized this operation for the user credentials you are using. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER.)

How would I go about authorising these permissions?

I have also reset my publishing profile on Azure, and downloaded a fresh profile to attempt it again. But no luck with that.

like image 288
Steven van der Merwe Avatar asked Jan 05 '16 13:01

Steven van der Merwe


3 Answers

The error is a bit deceiving. This likely has nothing to do with permission, but is instead caused by files being in use.

Does it always happen with Gehs.DbFactory.dll, or is it sometimes other files? Also, is Gehs.DbFactory.dll a regular managed assembly, or native/mixed assembly?

Normally, all assemblies get shadow copied, so they are not locked in the bin folder. If if it's native, it could end up getting loaded in place.

Note that if that's the case, it's not Azure specific, and you'd likely have the same issue deploying anywhere. e.g. try deleting this file from your bin folder while running locally.

One way or another, you need to make sure that no file gets locked in place if you want to publish newer version.

If you can't find a way to do this, here is a technique that should let you publish without any downtime:

  • using Kudu Console, go to your d:\home\site\wwwroot\bin folder
  • Renaming the offending DLL, e.g. to Gehs.DbFactory.dll.old (renaming normally works even if you can't delete it)
  • Do your publishing
like image 110
David Ebbo Avatar answered Oct 20 '22 17:10

David Ebbo


For me the fix was to set the Remove additional files at destination setting to true.

I am on .NET 6 and just recently migrated from .NET Core 3.1 to .NET 6

enter image description here

like image 32
Brendan Sluke Avatar answered Oct 20 '22 18:10

Brendan Sluke


Same thing was happening to me when I added a new folder under Content in my project and then tried to publish. I just restarted the app on Azure and then it worked fine.

like image 3
Dan Avatar answered Oct 20 '22 18:10

Dan