VSTS deployment not working properly - azure

I've got .Net solution Built in VSTS. My Release also succeeded but I'm not able to see my WebApplication running. Find the screenshot attached
Please find my Deploy azure app service task screenshot attached .
Please suggest if i miss any configuration.

I see your package or folder to deploy in Deploy Azure App Service task is pointed to drop folder. Instead it should be pointed to zip file inside the drop folder.
Eg: $(System.DefaultWorkingDirectory)/TestApp/drop/TestApp.zip
Try this and update if any other issue.

It is the content of hostingstart.html, which is in the wwwroot folder of app service, you can check the files by accessing https://[web app name].scm.azurewebsites.net/DebugConsole and go to site\wwwroot folder.
If the app service can’t recognize the web project (e.g. Global.asax) and there aren’t the default page files (Web service Application settings.), it will display hosttingstart.html page)
So, you need to check the files in release artifact.
If it is the web deploy package (zip file), you need to publish it through Web Deploy. (Check Publish using Web Deploy option and specify package path in Package or folder box (e.g. $(System.DefaultWorkingDirectory)/**/*.zip), you can clear additional files by checking Remove additional files at destination option)

Related

Azure App Service Restart required after uploading new contents to FTP

I have some app services and I update the web sites content by uploading the data via FTPS.
Occasionally, after I upload new content, the sites don't display it at all or partially until the app service is restarted.
Is this normal behavior?
What can be done to avoid restarting or monitoring the site and automatically restarting the app service if the site does not appear properly after updating the content?
Thanks
Just to highlight, based on your application framework - Unlike Git-based deployments and Zip deployment, FTP deployment doesn't support build automation, such as: dependency restores (such as NuGet, NPM, PIP, and Composer automations), compilation of .NET binaries, generation of web.config (here is a Node.js example).
You may generate these necessary files manually on your local machine, and then deploy them together with your app.
Additionally, App Service deploys files to the wwwroot folder. It never directly restarts your app.
You may verify if the deployment files are in root folder. A deployment issue is an issue that causes the wrong set of files to get deployed to your site folder (typically d:\home\site\wwwroot). Deployment-vs-runtime-issues

Adding additional files to VSTS Release to azure web app

I have a release in VSTS to deploy my webapp to the azure app service. For this I use a Azure App Service deploy step. After the normal deploy of the webapp I want to add an additional zip artifact from another build result. I want to copy only those file to a specific path of the web application on azure. How can I do that?
If the zip file is the web deploy package, you can refer to Joy’s answer. (Need to check Application option)
Otherwise, the simple way is using Kudu REST API (remain folder structure), steps:
Uncheck Publish using Web Deploy option of Azure App Service Deploy task
(Optional) Add Unzip task to extract zip files to a folder in artifact folder (the folder that you want in app service, e.g. D:/1/a/mylib)
Specify folder (parent folder of step 2 to remain folder structure) or package (zip) in Package or folder input box
You could use Virtual applications and directories to do it.You could check my steps.
Go to azure portal -> APPLICATION -> APPLICATION SETTINGS->Virtual applications and directories
set virtual directory with virtual path : /YourApplication to site\YourApplicationorsite\wwwroot\YourApplication
Go to VSTS-> the release option-> the Deploy Azure App Service task
set virtual application to /myApplication
Hope it can help you.
If using Azure DevOps for your CI then an alternative solution is to zip your file(s) including directory structure from the web root and add them into DevOps as a 'secure file' (find this under library/secure files once you've configured an Azure KeyVault).
Then add a pipeline task to download the secure file (use "Download secure file" task) to your build server. Make sure you add a "Reference name" to this task so you can reference the downloaded file path in a later step.
Then add a stand-alone "Azure App Service Deploy" step to deploy just this zip file. Select deployment method of "Zip deploy" and reference your downloaded secure file in the "Package or folder" section, like $(secureFileReferenceName.secureFilePath).
This effectively downloads the zip file from secure storage to the build agent and unzips it to wwwroot in the App Service.

cannot delete wwwroot on azure

I am trying to run an NodeJs app on Azure app services for Linux. After a failed deployment I would like to delete the wwwroot folder and start from scratch, but I am not able to delete it.
I have tried using ssh, bash, ftp and the Kudu REST API, but every time the result is the same.
This is the response from the DELETE call:
{"Message":"Cannot delete directory. It is either not empty or access is not allowed."}
Looks like there's an hidden .bin folder inside /node_modules that is blocking the delete operation.
Any hint?
I ran into this same issue today and resolved it by deleting the following App settings from Azure; WEBSITE_RUN_FROM_ZIP and WEBSITE_RUN_FROM_PACKAGE (Both settings do the same thing, just different names).
This was following instructions in Vikas Guptas blog on 17 Aug.
Not sure if you are using VSTS (Azure devops) but it may be helpful to some people to know that using version 4 of Azure App Service Deploy automatically sets the Website_Run_From_Package flag.

FTP'ing a Suave app to Azure

Having never used Azure before I'm attempting to deploy a simple F# Suave app to Azure using FTP. Ultimately I want to deploy via github but I initially thought FTP'ing it would be the easy first step. According to https://suave.io/azure-app-service.html it should be straight forward.
These are the steps I followed
Created a new web app in Azure including a resource group
and app service plan. All on the Free Tier.
Downloaded the publishsettings XML file that Azure created.
Cloned this repo: https://github.com/isaacabraham/fsharp-demonstrator
Used FileZilla to connect via FTP using the creds
from step 2.
Uploaded the files (via FTP) from
fsharp-demonstrator/src/SuaveHost (which includes the necessary web.config file) from the repo cloned at step 3 to
the site\wwwroot on Azure.
Navigated to Azure site url.
Then I receive the error:
The specified CGI application encountered an error and the server terminated the process.
(When I look at the folders on Azure under site\wwwroot I don't see any obj or bin folders. I don't think any msbuild process occurred. That doesn't seem right.)
Anybody got any idea what the problem is?
I suspect the issue is that when you deploy via FTP, then Azure does not automatically run the deploy script specified in the .deployment file.
The build.fsx script uses Kudu service to deploy the built files, so it might be easier to just use Github deployment rather than FTP - this way, Azure will do the deployment for you.
If you want to deploy via FTP, you'll need to build the project locally and upload the output. I'm not sure how to best do this with Isaac's Kudu-based demo though (ultimately, you need web.config that points to your built executable like this)

How can I use the TFS Online <--> Azure Website integration when there are two web apps in the solution

I am trying to get continuous integration configured using Azure. The process I have followed is exactly as detailed by Continuous delivery to Windows Azure using Visual Studio Online
This process works perfectly! I check-in, it builds, and deploys to the Azure website. However, as soon as I add a second web application to the solution, after the CI build kicks off and then completes, the only thing that gets published to the website is the bin directory of the second web application! (Updates to the first project are successful, though)
Given the scenario, I don't understand why the dll's of the second application are being published to the bin directory when the rest of the application(i.e. content files) are not. There is no reference from app1 to app2 so the dll's shouldn't be brought in by reference.
How can I configure this so that it will also publish the second web application?
You can tell Windows Azure Web Sites which project within a repository to deploy using a deployment file.
Add a file called .deployment to the root directory of your repository, with this content:
[config]
project = src/MyApp.Web
You can specify the folder containing the web application, or the actual .csproj or .vbproj file for the application.
If you have two sites in a single solution/repository and you want to publish them both, you will need to use two separate Web Sites, and use App Settings in the portal to specify the project instead. Create the sites, and for each, add a setting called Project in the Configure page, with the path to the directory or project as before.
More info: https://github.com/projectkudu/kudu/wiki/Customizing-deployments (Kudu is the system that actually handles deployments on Azure Web Sites)

Resources