Azure WebJob - Create Directory fails


I am trying to publish an azure webjob from the VisualStudio, but it fails with error

An error was encountered when processing operation 'Create Directory' on 'D:\home\site\wwwroot\app_data'. The error code was 0x80070002. Could not find file 'D:\home\site\wwwroot\app_data'. at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath) at Microsoft.Web.Deployment.DirectoryEx.CreateDirectory(String path)
at Microsoft.Web.Deployment.DirPathProviderBase.CreateDirectory(String fullPath, DeploymentObject source) at Microsoft.Web.Deployment.DirPathProviderBase.Add(DeploymentObject source, Boolean whatIf) Publish failed to deploy.

When I login to this WebApp in portal and open terminal I cannot see the web_app folder. And when I try to create it using mkdir it fails with

The system cannot find the file specified.

I tested it a bit more - and I cannot create any folders there!

Why the wwwroot folder might be locked?

If I try the same thing with a different WebApp - all works fine. I dont want to recreate the webapp


Application is deployed with WEBSITE_RUN_FROM_ZIP = 1 option. And it is a .NetCore 2.1 web app.

So the next question is:

1) How to add WebJob application to be published into a same package as webapp using dotbet publish command? (similar to

2) Or how to deploy the WebJob into alternative location like d:\home\site\jobs\ in VSTS?


Found a workaround that I dont really like. But it works. But I am more than open for a better solutions.

This one is based on 2 answers ( and listed below:

1) During the build phase build the whole solution using MSBuild with magic arguments similar to the ones provided in this answer -

2) Then, still in a build phase run dotnet publish for the webapp project, but without zipping

3) As a final accord of a build copy the "app_data" of the webjob (from step 1) into the publish location of the webapp (step 2) and zip it all together.

4) In the release phase deploy using the artifacts as usual. Just make sure that you removed all your previous attempts to solve the problem using "WEBJOBS_ROOT_PATH" environment variable...

asked on Stack Overflow Aug 28, 2018 by JleruOHeP • edited Aug 28, 2018 by JleruOHeP

1 Answer


What worked for me was going into the Azure portal, deleting the "WEBSITE_RUN_FROM_ZIP" configuration setting, and republishing.

answered on Stack Overflow Oct 28, 2019 by Code Slinger

User contributions licensed under CC BY-SA 3.0