Unable to Deploy to Azure Function - The error code was 0x80070002. ---> System.IO.IOException: Could not find file

Hi All,

I am trying to automate deploying to an Azure Function using the Deploy to An Azure Web App step template.

While attempting to deploy a package to the www directory, I receive this error:

Microsoft.Web.Deployment.DeploymentClientServerException: An error was encountered when processing operation ‘Create File’ on ‘D:\home\site\wwwroot\myfile.cs’. —> Microsoft.Web.Deployment.DeploymentException: The error code was 0x80070002. —> System.IO.IOException: Could not find file 'D:\home\site\wwwroot\myfile.cs

After searching the internet, it was suggested that I removed the WEBSITE_RUN_FROM_PACKAGE application setting from Azure. After removing that setting, I still encounter the error. Any suggestions?

Hi Jason,

Thanks for getting in touch! Yeah that is a very common culprit I’ve found as well. Just to confirm, you set WEBSITE_RUN_FROM_PACKAGE to specific value 0 on the application settings? It seems like another possibility might be due to timeouts caused by network slowdowns.

I’m hoping a copy of your verbose task log might give us some more insight into this error and the context around it. Would you be willing to enable the debugging variables in your project (OctopusPrintVariables and OctopusPrintEvaluatedVariables, both with a value of True), create and deploy a new release and send the resulting task log? Feel free to email them to us at support@octopus.com for privacy and security if so. :slight_smile:

Best regards,

Kenny

I solved the problem. I actually had to change the WEBSITE_RUN_FROM_PACKAGE to 0 for the Staging slot, which was still set to 1.

Thanks

Hi Jason,

Great to hear you solved this one! Please don’t hesitate to reach out anytime if we can try to help with anything in the future. :slight_smile:

Best regards,

Kenny

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.