On trying to deploy and publish a simple Umbraco site onto Azure using Visual Studio. The site will not start due to a 503 error.
In the logs, the following keeps coming up;
Application: w3wp.exe CoreCLR Version: 8.0.1224.60305 .NET Version: 8.0.12 Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.DirectoryNotFoundException: C:\home\site\wwwroot\wwwroot\media\ at
Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters) at
Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root) at Umbraco.Cms.Core.IO.PhysicalFileSystem.Create() at
The steps I have tried to make this error go away:
create an empty folder called media at wwwroot/wwwroot/media.
create an empty folder called media at wwwroot/media as well.
delete the above two folders
Changing appsettings.json to use Blob Storage using a container I set up specifically for this website.
I would suggest for now you add an empty text file in the media folder and check that into source control, that way, when deploying, it should bundle that into a media folder so that it will always exists on the server.
This doesn’t work, because when you create the text file - Visual Studio tries to delete the text file on deploying it and then it can’t and then the build fails:
Web Deploy cannot modify the file 'media' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.
The process cannot access '\\?\C:\home\site\wwwroot\wwwroot\media' because it is being used by another process.
at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath)
Hmm, must be a way to tell msbuild to try not to do that.
Really though, I’d love to know how this problem even starts, there’s 1000 of people who deploy to azure every day, multiple times that don’t have this problem. So I’m wondering what they’re doing differently from you and the people on the issue tracker. Umbraco Cloud uses Azure appservice too without this problem. Curious…
When I try ZipDeploy, the task fails unexpectedly. I am targeting a Windows App Service
:\Program Files\dotnet\sdk\9.0.200\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.ZipDeploy.targets(58,5): Error MSB4018: The "ZipDeploy" task failed unexpectedly.
System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The remote name could not be resolved: 'webforprofessionals.scm.azurewebsites.net'
I tried enabling SCM Basic Auth Publishing and I changed the pubxml to your suggestion but still got the same error:
C:\Program Files\dotnet\sdk\9.0.200\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.ZipDeploy.targets(58,5): Error MSB4018: The "ZipDeploy" task failed unexpectedly.
System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The remote name could not be resolved: 'webforprofessionals.scm.azurewebsites.net'
It’s the correct username and PublishUrl because it works totally fine when using MSDeploy.
It is only ZipDeploy that doesn’t work.
I think we can conclude the following from this issue:
The Umbraco team needs to look over how Azure reads the media folder: Azure should be able to detect the media folder when it is in wwwroot - my issue has proven that it can’t.
The deployment process to Azure needs to be looked over in further detail as at the moment it is too difficult to get a basic website up and running on it - I have now been trying to do this for one week and have failed and there is nothing obviously incorrect about my configurations.
When these issues are resolved, I am sure that it would be a better experience for everyone looking to get started with Azure.
It generally isn’t this complicated, however I have seen a specific issue with some regions such as Canada that you are using. The issues are generally due to the additional subdomain level.
e.g. mysite.scm.azurewebsites.net should be mysite.scm.canadacentral-01.azurewebsites.net
When using the Visual Studio publish dialog have you tried to tick the “Deploy as ZIP package” option, this will then use ZipDeploy but hopefully the wizard will validate all the other settings.
Ahh, what tier is your Azure Web App? This normally occurs on shared or free tier as Umbraco requires more space to deploy than is allowed on those tiers.
I tried again with your suggestions and it copied the entire media folder over successfully because I can see it in the files.
However, it now says “boot failed” with the same error message in the logs saying the media file is missing even though it exists in the correct location and all the correct media files for my website are in there.