1

I'm new to using DevOps and new to the forum. I have been trying to learn Pipelines and CI/CD systems but have been stuck attempting to get a build deployed. Any insights or leads would be much appreciated.

I have a single repository with 3 directories, 1 x .NETCore API, 1 x Angular front end application and 1 with IdentityServer4.

I have a CI pipeline and a CD pipeline that both pass. But I get a HTTP 500.0 error when visiting the domain.

I get the feeling it is something to do with the pipelines that I don't understand properly and have been trying to figure it out. Any thoughts?

Setup: Azure DevOps, Virtual Machine - Windows Server 2016 Datacenter

Build YAML:\

pool:
  name: Azure Pipelines
steps:
- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore
    projects: '$(Parameters.RestoreBuildProjects)'

- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '$(Parameters.RestoreBuildProjects)'
    arguments: '--configuration $(BuildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: test
    projects: '$(Parameters.TestProjects)'
    arguments: '--configuration $(BuildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(BuildConfiguration) --output "$(build.artifactstagingdirectory)"'
    zipAfterPublish: True

- task: CopyFiles@2
  displayName: 'Copy ARM templates'
  inputs:
    SourceFolder: ArmTemplates
    TargetFolder: '$(build.artifactstagingdirectory)'

- task: CopyFiles@2
  displayName: 'Copy Database File'
  inputs:
    Contents: '**\*.sql'
    TargetFolder: '$(build.artifactstagingdirectory)'
    flattenFolders: true

- task: UseNode@1
  displayName: 'Use Node 10.x'
  inputs:
    checkLatest: true

- task: Npm@1
  displayName: 'npm install'
  inputs:
    workingDir: 'APP'
    verbose: false

- task: Npm@1
  displayName: 'npm custom'
  inputs:
    command: custom
    workingDir: 'APP'
    verbose: false
    customCommand: 'install -g @angular/cli'

- task: Npm@1
  displayName: 'npm custom'
  inputs:
    command: custom
    workingDir: 'APP'
    verbose: false
    customCommand: 'run build --prod'

- task: ArchiveFiles@2
  displayName: 'Archive APP/dist'
  inputs:
    rootFolderOrFile: 'APP/dist'
    archiveFile: '$(Build.ArtifactStagingDirectory)/dest.zip'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

Release steps:

  • Azure resource group deployment
  • Azure SQL Database deployment
  • IIS web app manage
  • IIS web app deploy

Any help is appreciated. Cheers, Hazzard

1 Answer 1

0

I remember running in to this when .NET core 2 or 3 was rolling out to Azure. After banging my head on it for a long time, the entire issue was around microsofts new hosting module. So, in order to fix it, you need to set the hosting model to out of process.

TL;DR: Add this to your csproj file:

<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>

Example:

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>

There's quite a few github issues around it:

Here's the docs around the hosting model: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.1

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the reply mwilson, I applied the recommended fix and no luck initially. But with a bit more tinkering I found I had also forgotten to update the .NETCore to 3.1.x. Much appreciated for your help. I can now stop bashing my head into the wall :P Just to get Ident server 4 to work on a VM with IIS now :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.