I am trying to deploy a .NET (not .NET Core) web api using Azure DevOps to an Azure Web App. Its a standard issue web api which i have no issues running locally or deploying via Visual Studio Code Azure Deploy extension.
I have the following YAML file. The entire pipeline runs fine without any errors. No errors in the YAML file itself.
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
includeRootFolder: false
- task: AzureWebApp@1
inputs:
azureSubscription: 'BariBasicConnection'
appName: 'baribasicsapiserverjune21st2020b'
package: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
The web app itself, when I try to load, it gives the following error.
The service is unavailable.
And, when i check the app files via Kudu, I see this in the wwwroot folder, webconfig file.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name = "Site Unavailable" stopProcessing = "true">
<match url = ".*" />
<action type = "CustomResponse" statusCode = "503" subStatusCode = "0" statusReason = "Site Unavailable" statusDescription = "Could not download zip" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
At this point, I am pretty sure, I am not picking up the right folder to deploy or something but Azure DevOps focuses mostly on .NET Core and Node and I am finding it difficult to find .NET specific related solutions.
cd "$(build.artifactStagingDirectory)" & dir /s /b
that should let you find the actual path to the zip file you're trying to deploy. – jessehouwingdir /s /b
once should tell you the correct path to put in your YAML, then you can remove it that call. – jessehouwing