'How do you direct Azure DevOps to place your output in a specific location on the target App Service?
I'm trying to create a WebApi that will also work as a Service Worker. There are several examples on the web, but the issue I keep running into is the deployment either works as a WebApi, or a ServiceWorker, but not both.
As nearly as I can figure out what's wrong, it appears that the WebApi needs to be deployed into the directory: app_data\Jobs\Continuous\WorkerService. However, I can't seem to coerce the Azure App Service deployment to drop the files in this directory. This is what I have so far:
The pipeline:
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: DotNetCoreCLI@2
displayName: Build Solution
inputs:
command: build
- task: DotNetCoreCLI@2
displayName: Publish Artifact
inputs:
command: 'publish'
publishWebProjects: no
arguments: --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)\app_data\Jobs\Continuous\WorkerService
- task: PublishBuildArtifacts@1
displayName: Upload Artifacts
and the Release:
steps:
- task: AzureRmWebAppDeployment@4
displayName: 'Azure App Service Deploy: thetarex-worker-service'
inputs:
azureSubscription: 'Theta Rex Subscription'
WebAppName: 'thetarex-worker-service'
When I run this, I get all my files in wwwroot - no directory structure is preserved. The WebApi part works, but no worker services run and no WebJob is created.
Solution 1:[1]
In App Service configuration - Path mapping, create Virtual Application with Physical Path targeting site\wwwroot\App_Data\Jobs\Continuous\WorkerService and setting pipeline like this:
steps:
- task: AzureRmWebAppDeployment@4
displayName: 'Azure App Service Deploy: thetarex-worker-service'
inputs:
azureSubscription: 'Theta Rex Subscription'
WebAppName: 'thetarex-worker-service'
VirtualApplication: your_virtual_application
This should get all your files into Physical path you configured with Virtual Application.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
