[英]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.我正在尝试创建一个也可以作为 Service Worker 工作的 WebApi。 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. web 上有几个示例,但我一直遇到的问题是部署要么作为 WebApi,要么作为 ServiceWorker,但不能同时作为两者。
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.就我所能弄清楚的问题而言,WebApi 似乎需要部署到目录中:app_data\Jobs\Continuous\WorkerService。 However, I can't seem to coerce the Azure App Service deployment to drop the files in this directory.但是,我似乎无法强制 Azure App Service 部署将文件放到该目录中。 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.当我运行它时,我得到了 wwwroot 中的所有文件——没有保留目录结构。 The WebApi part works, but no worker services run and no WebJob is created. WebApi 部分工作,但没有工作人员服务运行,也没有创建 WebJob。
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:在 App Service 配置 - 路径映射中,创建具有物理路径目标 site\wwwroot\App_Data\Jobs\Continuous\WorkerService 的虚拟应用程序,并像这样设置管道:
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.这应该将您的所有文件放入您使用虚拟应用程序配置的物理路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.