1
votes

I have an Angular 8 + asp.net core 3.1 application generated by Visual Studio 2019.

I tried to deploy the application as is without modification on the Azure Linux App Service by using a VS 2019 Publish and the application gets deployed with no issue and I can access the application from web browsers on the <app-name>.azurewebsites.net url

When deploying the application from an Azure release pipeline with the Azure App Service deploy Task, the deployment occurs with no errors but when requesting <app-name>.azurewebsites.net I get the default site as in the following screenshot enter image description here

It seems that the deployment has no effect from Azure DevOps. What am I doing wrong?

Details

Build pipeline

trigger:
- master

pool:
  vmImage: 'windows-2019'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: Npm@1
  displayName: 'npm install'
  inputs:
    command: 'install'
    workingDir: 'MyApp/ClientApp'
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  displayName: 'nuget restore'
  inputs:
    restoreSolution: '$(solution)'
- task: Npm@1
  displayName: 'ng build'
  inputs:
    command: 'custom'
    workingDir: 'MyApp/ClientApp'
    customCommand: 'run build'

- task: DotNetCoreCLI@2
  displayName: 'dotnet build release'
  inputs:
    command: 'build'
    arguments: '-c $(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: 'publish'
    publishWebProjects: true
    arguments: '-r linux-x64 -c release --output $(build.ArtifactStagingDirectory)'
    
- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact Website'
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'MyAppDropDir'
    publishLocation: 'Container'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact ARM Template'
  inputs:
    PathtoPublish: '$(Build.SourcesDirectory)/MyApp.AppService'
    ArtifactName: 'ARMTemplate'
    publishLocation: 'Container'

Release Pipeline

enter image description here

2

2 Answers

3
votes

One thing you could do is goto the Kudu console of the deployed web application and see if the actual code has been deployed.

For eg: https://.scm.azurewebsites.net/ where name is the name for your web app.

Also as I see you need to set up a startup command on the release pipeline as dotnet aspnet-core-dotnet-core.dll

Another thing you could try is by setting a new Devops Project and then replace the source code with your repository. You can navigate to Azure portal -> Devops Project, you can pick .Net and then Core3 as the template just to see what went wrong

1
votes

make sure you run a startup command either in portal.azure.com in configuration settings or from within the devops.

dotnet your-project-name.dll

startup command to run

I hope it helps