1
votes

I deploy a web app to Azure App Service using zip-deploy:

dotnet build /nologo /p:PublishProfile=Release /p:PackageLocation="c:\Repos\world\world" /p:OutDir="c:\Repos\world\world" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /maxcpucount:1 /p:platform="Any CPU" /p:configuration="Release" 

az webapp deployment source config-zip --resource-group <resource-group> --name <app-name> --src world.zip

But the app does not start or is not executed properly, leading to the following error when accessing the application url:

You do not have permission to view this directory or page.

I tried using git-deploy and it works and by going to the URL I see

Hello, world!

I put all the code on GitHub for reference: https://github.com/fnbk/world

More details:

  • It is a very simple ASP.NET Core Web App with only one root route
  • .NET core 2.2
  • adding the variable WEBSITE_RUN_FROM_PACKAGE at Application Settings to 1 also did not work
2
Using the Kudu tools or with an FTP client, look at the folder structure when using each deployment method. There's likely an extra folder in that zip file.CSharpRocks
Thanks for the hint. I double checked the folder structure and it seems to be fine since some meta files (archive.xml and parameters.xml) in the root of the zip file carry the full path the the artifacts. And if I am not mistaken, then the zip file will be mounted into the wwwroot directory sourceFlorian Boehmak
I ran into the same issue you did. Upon further inspection of the zip file itself, it's contains the same folder structure of the project output. When checking kudo, it's unzipped using that exact folder structure which I believe is causing wwwroot contents to not be mounted correctly just as @CSharpRocks noted. This could be a bug one of the switch arguments.Ryan Hill - MSFT

2 Answers

2
votes

I don't think this will work. The zip file that gets created I think isn't mountable for Kudu. I did create a github issue (see https://github.com/dotnet/cli/issues/11254) though but since there are other methods, such as Azure local git, I'm not sure when this issue will get resolve.

1
votes

The file created with WebPublishMethod=Package is intended for deployment via Web Deploy, which is a very different deployment technology. You need to use dotnet publish instead, and zip the resulting directory yourself.