Azure-docs: Documentation doesn't detail the structure of the zip file

Created on 24 Jan 2019  Â·  14Comments  Â·  Source: MicrosoftDocs/azure-docs

This documentation says its possible to deploy a zip file to an API app.
However what should be zipped up isn't detailed? Is it the full project folder? or is it only the published application?

I've tried deploying many sample API applications from here - https://github.com/aspnet/Docs/tree/master/aspnetcore. None of them appear to show and no logs appear for any of these either. Would be nice to know what to put in the zip file before pushing to an App Service.

Steps to reproduce:

  1. Build the sample API app here - https://github.com/aspnet/Docs/tree/master/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi using the dotnet (core) cli 2.1.
  2. Publish the application using dotnet publish.
  3. Zip the published application
  4. Push the zip to an Azure API App using the Azure command line.

This works locally with dotnet core 2.1, however when deploying to the Azure API service I don't get a response.

Problem:

  • Can't see logs within Azure for the deployed application.
  • Clicking on the FQDN for the App service results in the error "You do not have permission to view this page" or "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

app-servicsvc assigned-to-author doc-enhancement triaged

All 14 comments

@rbhadti94, Thank you for your feedback!
As mentioned in the same document, ‘If you downloaded the files in a ZIP file, extract the files first. For example, if you downloaded a ZIP file from GitHub, you cannot deploy that file as-is. GitHub adds additional nested directories, which do not work with App Service.’ Kindly ensure that all the files are extracted.
You need to create a ZIP archive of everything in your project. This directory should contain the entry file to your web app, such as index.html, index.php, and app.js. It can also contain package management files - like project.json, composer.json, package.json, bower.json, and requirements.txt.

Also, ensure that there is a default page appropriately set in the project root folder. To fetch more details on the error, you could also enable Application Event Log, checkout the document for more details: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/azure-apps/troubleshoot?view=aspnetcore-2.2#troubleshoot-app-startup-errors
I see that you have already closed this issue, If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

Hi @AjayKumar-MSFT - Thanks for the response.

I wasn't using the Github repository directly. I went into the sample app root folder when running all my commands.

It actually turns out that I was restoring/publishing/zipping the sample app (linked in my original issue) using the following commands:

dotnet restore
dotnet publish -o ./myapp
zip -r myapp.zip ./myapp/*
## Then deploy this zip to the Azure API App Service

However this fails for the API app service because the Azure API App service runs natively off a Windows based App service plan. And by defaultdotnet publish produces an app for a linux target system. Hence deploying this zip file to the app service will fail.

The solution is to do:

dotnet restore
dotnet publish -o ./myapp --runtime win-x64
zip -r myapp.zip ./myapp/*
## Then deploy this zip to the Azure API App Service

Note the --runtime win-x64 extra args when publishing. This way the published binaries match the target platform.

I'm aware that different App services come with different plan types (Windows or Linux plan types). It should probably be made clear that when publishing, the correct runtime has to be targeted.

I'll have a trawl through the existing documentation to see if it can be added in anywhere. At the moment the section Create a project ZIP file is a bit too vague. Because for different languages/frameworks (Java, .NET Core, .NET Framework etc...) the contents to zip will be different.

@rbhadti94, Thank you for your detailed feedback and sharing the solution that worked for you. Your feedback has been shared with the content owner (@cephalin) for further review.

Thanks @AjayKumar-MSFT.

@rbhadti94 and @AjayKumar-MSFT, I'm facing the same issue. I have a PHP site. When I deploy it using powershell. It gets deployed successfully but doesn't display anything on the page.
M I doing something wrong while deploying or do I need to follow any step post doing a Zip deploy using Invoke-RestMethod.

@vatsparth, Invoke-RestMethod request triggers push deployment from the uploaded .zip file. So, ensure that all the deployment files including the default document are available in site/wwwroot folder. You may navigate to Kudu Console (https://yourwebsite.scm.azurewebsites.net/) to review the files.

@AjayKumar-MSFT Yeah, I can see all the files present there via Kudu console. But I'm still not able to see anything up on the web page. Do we have any further steps post this.

@vatsparth, Could you please send an email to AzCommunity[at]Microsoft[dot]com referencing this GitHub issue and your Azure subscription ID, we would like to work closer with you on this matter.

@AjayKumar-MSFT,
Thanks, Sure will do that. But before that I just wanted to make sure. Does it work the same way for docker based Web Apps?

@vatsparth, If your question is specifically about the build requirements - With continuous deployment, you can get your app up and running on Azure directly from source code. No external build or publication process is required. However, there is a limit to the customizability and availability of build tools within the Kudu deployment engine. Your app may outgrow Kudu's capabilities as it grows in its dependencies or requirements for custom build logic. Checkout this document for more details on this topic. Kindly let us know if you need any further help.

@vatsparth - For Docker based web apps, the image should be self-contained. i.e. your Docker entrypoint needs to call/run an executable which can run the web application. E.g.

ENTRYPOINT[ "ng serve"] #Angular
ENTRYPOINT["dotnet <somedll>.dll"] #Dotnet
ENTRYPOINT["java -jar <myapp>.jar"] #Java

@rbhadti94 A few comments:

  • dotnet publish is not in the scope of App Service documentation, so I think it's appropriate to doc this caveat in our doc set.
  • This isn't the easiest approach to upload a .NET/Core app to App Service. The more straightforward method would be using Visual Studio publish, or if you must use ZIP deploy, I recommend letting App Service do the automated build for you instead of building it yourself. You can do this by adding the SCM_DO_BUILD_DURING_DEPLOYMENT=true app setting. It's not directly shown in the doc but is in a linked doc for enabling automated build.

Hi @cephalin ,

Thanks for the reply. I agree for development environments and for prototyping this is ideal.

I'm talking from the perspective of higher environments (higher than dev). I'm aware that we can set SCM_DO_BUILD_DURING_DEPLOYMENT=true but from my experience most are unlikely to deploy directly to higher environments from source control (or from Visual Studio).

I could be wrong but deploying a package is a much more common method which can be controlled/audited etc... and its worth having instructions for that (for every technology) somewhere in the docs.

@rbhadti94 Thanks for offering your feedback. We'll consider this for our documentation updates. For now I'm going to close this issue. #please-close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Agazoth picture Agazoth  Â·  3Comments

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

bityob picture bityob  Â·  3Comments

varma31 picture varma31  Â·  3Comments