Azure WebJob - Create Directory fails

4

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

UPDATE

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 https://stackoverflow.com/a/50046561/1300049)

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

UPDATE 2

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 (https://stackoverflow.com/a/40049524/1300049 and https://stackoverflow.com/a/46661421/1300049) listed below:

1) During the build phase build the whole solution using MSBuild with magic arguments similar to the ones provided in this answer - https://stackoverflow.com/a/46661421/1300049

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...

visual-studio
azure
azure-devops
azure-webjobs
asked on Stack Overflow Aug 28, 2018 by JleruOHeP • edited Aug 28, 2018 by JleruOHeP

1 Answer

1

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