"Azure Web App Deploy" vs "Deploy Azure App Service" - azure-devops

If we are deploying a basic WebApp / WebApi, both these tasks from Microsoft appear to do the same thing - deploy to an appservice.
AzureWebAppV1
AzureRmWebAppDeploymentV4
How do you choose which one to use in a new YAML release pipeline? I just want to make sure I am using the version that is most future-proof - I have 25 release pipelines and don't want to have to re-do them unless necessary.
The way the help is written, hard to compare feature to feature to spot the key "must-haves". Some Microsoft online examples use both. Both are still marked as "In Development" in the readme and both are >1 year old since last check in.

The simplest way to deploy to an Azure Web App is to use the Azure Web App Deploy (AzureWebApp) task.
By default, your deployment happens to the root application in the Azure Web App. You can deploy to a specific virtual application by using the VirtualApplication property of the AzureRmWebAppDeployment task.
Azure App Service Deploy task allows users to modify configuration settings in configuration files (*.config files) inside web packages and XML parameters files (parameters.xml), based on the stage name specified.

Just my two cents, but I just noticed Web App Deploy takes much less time than Service App Deploy. I was wondering how come a simple zip deploy (Service App Deploy) can take so long. So I looked around and found there's also that Web App Deploy, so I tested it.
My project (React/Next small sized app) normally takes 6-10 min to deploy with Azure Service App Deploy (v4). With Azure Web App Deploy (v1) it took a little more than a minute. Wow.

Related

Getting ERROR_FILE_IN_USE while using Web Deploy in Azure App Service Task v3

Similar questions have been asked various times, but most answers are old and may only partially apply. This question is specific to using Web Deploy through Azure DevOps/Azure Pipelines using the "Azure App Service Deploy" task, version 3.*.
Failed to deploy web package to App Service.
Try to deploy app service again with Rename locked files option selected.
Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'VBCSCompiler.exe' 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.
There's two recommendations there:
Select "Rename locked files" option
Restart the application
Use the AppOffline rule
Additionally, the documentation for the task reiterates recommendations 1 and 3 together.
For avoiding deployment failure with error code ERROR_FILE_IN_USE, in case of .NET apps targeting Web App on Windows, ensure that 'Rename locked files' and 'Take App Offline' are enabled. For zero downtime deployment use slot swap.
However, these recommendations are already in place.
All that's left is recommendation 2: restart the service. For many reasons, I rather not have to fall back to this.
Why are 1 and 3 not enough to complete the deployment successfully?
I spoke with a Microsoft support rep and was told that "Rename locked files" only works for DLLs.
But I did find a solution that did work for me. In "Additional arguments", I added "-useChecksum". So the "Deploy Azure App Service" task now looks like this
I haven't had any problems since.
There is an issue tracked here : Azure App Service Deploy fails for .net core 2.0 with ERROR_FILE_IN_USE and based on vincentdass's comment "PR #8457 for consuming new version of MSDeploy as per Web Deploy team recommendation." There will be an upgrade for msdeploy in future version.
However you can just checking Publish Using Web Deploy and Rename Locked Files, then creating a new deployment. Redeploy won't work because it won't pick up your changes to the release definition.
Reference below thread, you can check the discussion about this issue and troubleshoot accordingly.
Azure App Service Deploy fails for .net core 2.0 with
ERROR_FILE_IN_USE

How to deploy ASPNET Core site to Azure Linux Web App (no container)

I have a web app, and I've setup VSTS to create a package in build, and then deploy it using release management.
It puts all of the result in the wwwroot of the site if I look at it in ftp so I get:
/site/wwwroot/
/wwroot
/
This doesn't run and I get a 404 error.
If I use the URL and go say /wwwroot/images/ it returns it just fine.
The app is set to use .net core and I'm doing a self-contained package.
How do I get VSTS release to put the files in the right place and what is the right place ? I can't find any documentation on this anywhere. Everything is to do with Windows.
Also, what linux target should the dotnet application be set to for self-contained? I have it using ubuntu but I'm sure that's wrong and it's something else.
Please use Azure App Service Deploy task with 4.* (preview) version instead, and deploy again:
I had a similar issue and I responded here. Essentially you need to have a startup command pointing to your DLL because Dev Ops deploys the package in a different way than VS.
Deploying .Net Core to Linux WebApps on Azure with DevOps

Develop a Service Fabric Web Application without redeploying after each file change

I have stateless .net core 2 Fabric Service Web Application creating using one of the templates that comes with Service Fabric SDK. It is a real pain to develop since I have to do a full deploy before I can see any changes to code/html/script. In my case that operation takes more than 5 minutes.
I have looked at this article that states how it can be done by running the web app from the commandline.
That article is based on Net Core RC2. Does anyone has an updated example on how to do this?
https://dzone.com/articles/aspnet-core-with-kestrel-and-service-fabric
Together with Azure Developer Support i found a solution to speed up the development process
I Fabric Explorer you need to find the node where you Web Application is running. I my case that is _Node_0
By SF SDK design, local SF published file is under C:\SfDevCluster\Data_App\ this folder. In my environment, the website file path is C:\SfDevCluster\Data_App_Node_0\Application1Type_App1\Web1Pkg.Code.1.0.0\wwwroot\lib\bootstrap\dist
So you can also find your HTML, CSS, JS and other static resources under below path:
C:\SfDevCluster\Data_App[node_id][application_type_and_instance_name][service_type_and_version]\
You can just modify the files in this folder, then the change will immediately apply to your local test web browser. Please notice if your service is hosted by micro-service running in several nodes, you may need to modify all nodes files because load balancer may access any folder files randomly.

Azure Enable Web Deploy via automated deployment

Does anyone know of an automated way to deploy a web role to Azure with the "Enable Web Deploy" option enabled? We have an automated acceptance test process that deploys to Azure using Web Deploy to save time. But we would also like to automate the full deployment of the web role so that it could run off-hours on a less frequent basis.
We are currently using the WAPPSCmdlets module to automate full Azure deployments. However, neither this nor the newer official Azure Powershell cmdlets seem to expose a way to enable Web Deploy in new deployments.
What you'll need to do is create a startup task that does the following:
Download and install Web Deploy
Windows Azure Bootstrapper can help you to download and run the installer from a startup task.
Configure Web Deploy with PowerShell. You might want to start with this article: PowerShell scripts for automating Web Deploy setup
Running PowerShell from a startup task might seem tricky at first. If you run into trouble, take a look at this article: Azure Startup Tasks and Powershell: Lessons Learned
Keep in mind that this startup task should only run for CI deployments and not for your production deployments, so this might be something you need to take care of in your build process (you can use different Cloud projects in Visual Studio for example).

How Do I deploy an application to IIS while that web application is running

Where I work, we release bug fixes in to the system every night when we know our clients are not using the system.
Trying to take a step towards better service I'd like to deploy to IIS while the application is running.
A solution that comes to mind is to setup two different IIS applications and switch them over after deploy using a script. But I'm not going to try this out as I don't want any complications during our busy hours.
Does anyone have experience in this area of deployment?
Thanks
Regardless of whether you're using PHP, ASP, ASP.NET etc there is no native support for transactional deployment on IIS.
The simplest approach would be to have two physical folders and (optionally two web sites - one production, one test) on your web server, for example:
c:\websites\myapp\dep1
c:\websites\myapp\dep2
Initially your site would have its physical path pointing to c:\websites\myapp\dep1.
When you deploy your latest build you'd deploy into c:\websites\myapp\dep2. Once you're done just switch the physical path of the production site over to this folder. This means you still have the original site and can fall back to it if the new code fails for whatever reason.
The next time you do a deployment you'd deploy into c:\websites\myapp\dep1 and once you're done switch the production site to that folder.
You could optionally have a test site that points to the folder you're deploying to so you can make sure the site works before switching your production site over.
This could all be scripted.
Here's some related reading that may be of interest:
Publishing/uploading new DLL to IIS: website goes down whilst uploading
Is smooth deployment possible with componentized ASP.NET MVC apps?
Rob Conery also had an excellent blog post about the lack of a decent deployment story for ASP.NET application. You should take a trawl through the comments some of which are quite insightful:
ASP.NET Deployment Needs To Be Fixed
Getting Constructive On ASP.NET Deployment