skip to Main Content

I have a repository with my angular app. It works fine local.
I created pipline with yaml file in azure devops.

# Node.js with Angular
# Build a Node.js project that uses Angular.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- masters

pool:
  vmImage: ubuntu-latest

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '16.x'
  displayName: 'Install Node.js'

- script: |
    npm install -g @angular/cli
    npm install
    npm outdated
    npm run build:ssr --prod
  displayName: 'npm install and build'

- task: CopyFiles@2
  inputs:
    targetFolder: '$(Build.ArtifactStagingDirectory)'    

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'dist'
    ArtifactName: 'dist'

I have a release with this pipeline to my web app server in azure. This server with windows OS. I didn’t have a problem with it when my yaml file was with vmImage: ubuntu-latest.

Pipeline builds good and deploy to app server was going good too.
No I have a problem with this in my browser when I try to open my app.

enter image description here

I heard that I need to change path mappings in configuration.

I tried a lot of many cases. sitewwwroot, sitewwwrootmyappname, sitewwwrootmyappnamedist.

And instead You do not have permission to view this directory or page
I have now this
enter image description here
My Angular app was created with default command ng new test and have all configs.
I really don’t know what to do.

2

Answers


  1. Chosen as BEST ANSWER

    The problem was in my folder assets. I use server render and I need to set folder path such way sitewwwrootapp-name-from-package.jsonbrowser

    and add web.config to src and set him in angular.json in assets

    "assets": ["src/web.config"]


    • I have deployed an Angular app, initially I got the below error

    enter image description here

    • In Azure Portal => Configuration => Application Settings added SCM_DO_BUILD_DURING_DEPLOYMENT with value true

    enter image description here

    • And in Path Mappings, check whether Virtual Path is added or not.
      enter image description here

    • Navigate to KUDU Console from portal
      Azure Portal => Your Web App => Advanced Settings => Go => Debug Console, check whether the files and folder structures are correct and are under wwwroot directory
      enter image description here

    • Now Iam able to access my Web App without any issues.
      Output :

    enter image description here
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search