2
votes

I've inherited an ASP.NET (4.7.2) app that successfully runs and starts on my machine. I'm now trying to deploy it to an Azure App Service via an Azure DevOps Pipeline. In an attempt to do this, I've created an Azure Build Pipeline that includes the following tasks:

NuGet

Restores the packages based on the .sln file

MSBuild

Builds the .csproj that defines my ASP.NET app.

Azure App Service Deploy

Attempts to deploy the ASP.NET app as a "Web App on Windows" to my deployment slot. The "Package or folder" is set to MyAspNetApp/bin.

I can successfully build this pipeline. However, when I visit the URL allocated to my Azure App Service Deployment Slot, the only thing I see is "Hey, App Service developers! Your app service is up and running. Time to take the next step and deploy your code."

So, what am I missing? I would think you should just have to select the .csproj, the app service and the deployment slot. But, it seems more is required. All of the documentation I've found is for ASP.NET Core apps. However, my app is a traditional ASP.NET app.

4
You can find the answer here. It's for an Umbraco application but it really makes no difference. stackoverflow.com/questions/55649182/… .Once you're done with the build pipeline you need a release pipeline to deploy your artifacts to IISJabberwocky
# I have recently answer this question here check it out (stackoverflow.com/questions/56241490/…)Qamar Zaman
Does the behavior change if you use the publish on build option and assign that path to the Azure App Service Deploy task? I vaguely remember that publish is different from a straight build.Josh Gust

4 Answers

1
votes

You have done only the build step, now you need to deploy the code (artifcats) with the release step to the appservice.

Read the docs as mentioned here

0
votes

You need to go with the release steps to deploy the code. Just have a look at this.

0
votes

The main thing you need to change is how you build your app so you can actually publish it. Publishing it via a separate release pipeline is a best practice which you should consider once your deployment is actually working.

To get a build result which can be uploaded to Azure App Service, you need to set a msbuild argument like this:

 /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageLocation=$(build.artifactstagingdirectory)\Packages

Or like in this answer.

You can then take a look at the resulting build artifact to see if it worked. You can also do it locally. In my example you get a zip file which you can reference in the Azure App Service Deploy task. And since the zip file is already in the build artifacts, you can easily create a separate release pipeline which only contains the Azure App Service Deploy task once you are comfortable with it.

0
votes

Yes, we can deploy the app to Azure App Service directly from the build pipeline. Ignoring the concern about best practice and focusing the question yes we can since long using "Azure App Service Deploy" task in the build pipeline.

There is official Microsoft example demonstrating this scenario in Task 4 on this URL