用于将 ASP.NET Web 应用程序部署到自托管 Windows 代理的 Azure 多级管道:运行无误但未部署任何内容
Azure Multistage Pipeline to deploy ASP.NET web app to self-hosted Windows agent: Runs without error but nothing deployed
我正在尝试创建概念验证,将 ASP.NET 网络应用程序(.NET Framework,而非 .NET Core)部署到本地 Windows 服务器 运行 IIS.
我使用基于 YAML 的构建管道和使用经典 GUI 的发布管道让它工作。为了部署到本地服务器,我创建了一个部署组并将一个自托管代理部署到目标服务器。工作正常。
我的下一步是尝试创建一个基于 YAML 的多阶段管道,将构建管道转换为构建阶段并编写一个 b运行d 新部署阶段。据我了解,YAML 多级管道不支持部署组,因此我必须创建一个具有虚拟机资源的环境。我在目标服务器上创建了代理并将其自身注册为环境下的资源,因此设置看起来不错。在这种情况下,环境被命名为 "Dev".
我尝试了 运行 管道,它似乎工作正常,成功完成。日志显示部署阶段下载了在构建阶段创建的工件,IIS Web App Manage 和 IIS Web App Deploy 步骤 运行 正常。但是,目标服务器上的 Web 应用程序未更新。 Dev 环境下的资源,代表目标服务器,也显示 "Never deployed" 为最新作业,表明自托管代理从未下载过版本。
我假设由于日志没有显示错误,所以部署作业实际上是 运行 在 Microsoft 托管的代理而不是自托管代理上。鉴于 Dev 环境以自托管代理作为其唯一资源存在,我看不出我哪里出错了。关于我哪里出错的任何提示或建议?
这是完整的 YAML 文件:
trigger:
- '*'
stages:
- stage: 'Build'
displayName: 'Build the web application'
jobs:
- job: 'Build'
displayName: 'Build job'
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:TransformWebConfigEnabled=false /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- stage: 'Deploy'
displayName: 'Deploy the web application'
dependsOn: Build
jobs:
- deployment: 'DeployToDev'
displayName: 'Deploy the web application to dev environment'
pool:
vmImage: 'windows-latest'
variables:
Parameters.IISDeploymentType: 'IISWebsite'
Parameters.ActionIISWebsite: 'CreateOrUpdateWebsite'
Parameters.WebsiteName: 'Default Web Site'
Parameters.WebsitePhysicalPath: '%SystemDrive%\inetpub\wwwroot\AspNetDemo'
Parameters.AddBinding: false
Parameters.VirtualPathForApplication: '/AspNetDemo'
Parameters.AppPoolName: ''
Parameters.VirtualApplication: 'AspNetDemo'
Parameters.Package: '$(Pipeline.Workspace)\drop\*.zip'
Parameters.RemoveAdditionalFilesFlag: true
Parameters.TakeAppOfflineFlag: true
Parameters.XmlTransformation: true
Parameters.XmlVariableSubstitution: true
environment: Dev
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop
- task: IISWebAppManagementOnMachineGroup@0
displayName: 'IIS Web App Manage'
inputs:
IISDeploymentType: '$(Parameters.IISDeploymentType)'
ActionIISWebsite: '$(Parameters.ActionIISWebsite)'
WebsiteName: '$(Parameters.WebsiteName)'
WebsitePhysicalPath: '$(Parameters.WebsitePhysicalPath)'
AddBinding: $(Parameters.AddBinding)
ParentWebsiteNameForVD: '$(Parameters.WebsiteName)'
VirtualPathForVD: '$(Parameters.VirtualPathForApplication)'
ParentWebsiteNameForApplication: '$(Parameters.WebsiteName)'
VirtualPathForApplication: '$(Parameters.VirtualPathForApplication)'
AppPoolName: '$(Parameters.AppPoolName)'
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
inputs:
WebSiteName: '$(Parameters.WebsiteName)'
VirtualApplication: '$(Parameters.VirtualApplication)'
Package: '$(Parameters.Package)'
RemoveAdditionalFilesFlag: $(Parameters.RemoveAdditionalFilesFlag)
TakeAppOfflineFlag: $(Parameters.TakeAppOfflineFlag)
XmlTransformation: $(Parameters.XmlTransformation)
XmlVariableSubstitution: $(Parameters.XmlVariableSubstitution)
下面是部署阶段的原始日志文件:
2020-06-15T12:15:56.9858347Z ##[section]Starting: Deploy the web application to dev environment
2020-06-15T12:15:57.1573499Z ##[section]Starting: Initialize job
2020-06-15T12:15:57.1574831Z Agent name: 'Hosted Agent'
2020-06-15T12:15:57.1575185Z Agent machine name: 'WIN-5Q96T5JR7AD'
2020-06-15T12:15:57.1575401Z Current agent version: '2.170.1'
2020-06-15T12:15:57.1593854Z Current image version: '20200531.1'
2020-06-15T12:15:57.1601179Z Agent running as: 'VssAdministrator'
2020-06-15T12:15:57.1656829Z Prepare build directory.
2020-06-15T12:15:57.2207188Z Set build variables.
2020-06-15T12:15:57.2242403Z Download all required tasks.
2020-06-15T12:15:57.2403517Z Downloading task: DownloadBuildArtifacts (0.167.2)
2020-06-15T12:15:58.7871306Z Downloading task: IISWebAppManagementOnMachineGroup (0.5.15)
2020-06-15T12:15:58.8604155Z Downloading task: IISWebAppDeploymentOnMachineGroup (0.156.13)
2020-06-15T12:16:00.2584106Z Checking job knob settings.
2020-06-15T12:16:00.2595245Z Knob: AgentToolsDirectory = C:/hostedtoolcache/windows Source: ${AGENT_TOOLSDIRECTORY}
2020-06-15T12:16:00.2596590Z Knob: AgentPerflog = c:\agents\perflog Source: ${VSTS_AGENT_PERFLOG}
2020-06-15T12:16:00.2597479Z Finished checking job knob settings.
2020-06-15T12:16:00.2963001Z Start tracking orphan processes.
2020-06-15T12:16:00.3045878Z ##[section]Finishing: Initialize job
2020-06-15T12:16:00.3715796Z ##[section]Starting: Download
2020-06-15T12:16:00.4732035Z ==============================================================================
2020-06-15T12:16:00.4732834Z Task : Download build artifacts
2020-06-15T12:16:00.4733443Z Description : Download files that were saved as artifacts of a completed build
2020-06-15T12:16:00.4733725Z Version : 0.167.2
2020-06-15T12:16:00.4734218Z Author : Microsoft Corporation
2020-06-15T12:16:00.4734834Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/download-build-artifacts
2020-06-15T12:16:00.4735229Z ==============================================================================
2020-06-15T12:16:02.4240789Z Downloading artifacts for build: 206
2020-06-15T12:16:02.4263144Z Downloading items from container resource #/7981806/drop
2020-06-15T12:16:02.4263938Z Downloading artifact drop from: https://dev.azure.com/SimonE0675//_apis/resources/Containers/7981806?itemPath=drop&isShallow=true&api-version=4.1-preview.4
2020-06-15T12:16:02.4268251Z Downloading drop/AspNetDemo.deploy-readme.txt to d:\a\drop\AspNetDemo.deploy-readme.txt
2020-06-15T12:16:02.8224843Z Downloading drop/AspNetDemo.deploy.cmd to d:\a\drop\AspNetDemo.deploy.cmd
2020-06-15T12:16:02.8547084Z Downloading drop/AspNetDemo.SetParameters.xml to d:\a\drop\AspNetDemo.SetParameters.xml
2020-06-15T12:16:03.4437009Z Downloading drop/AspNetDemo.SourceManifest.xml to d:\a\drop\AspNetDemo.SourceManifest.xml
2020-06-15T12:16:03.4495772Z Downloading drop/AspNetDemo.zip to d:\a\drop\AspNetDemo.zip
2020-06-15T12:16:03.4516280Z Downloaded drop/AspNetDemo.deploy-readme.txt to d:\a\drop\AspNetDemo.deploy-readme.txt
2020-06-15T12:16:03.4523121Z Downloaded drop/AspNetDemo.SetParameters.xml to d:\a\drop\AspNetDemo.SetParameters.xml
2020-06-15T12:16:03.4525288Z Downloaded drop/AspNetDemo.deploy.cmd to d:\a\drop\AspNetDemo.deploy.cmd
2020-06-15T12:16:03.4561228Z Downloaded drop/AspNetDemo.SourceManifest.xml to d:\a\drop\AspNetDemo.SourceManifest.xml
2020-06-15T12:16:03.8676511Z Downloaded drop/AspNetDemo.zip to d:\a\drop\AspNetDemo.zip
2020-06-15T12:16:04.8013454Z Total Files: 5, Processed: 5, Skipped: 0, Failed: 0, Download time: 3.039 secs, Download size: 5.572MB
2020-06-15T12:16:05.3818312Z Successfully downloaded artifacts to d:\a/
2020-06-15T12:16:05.3852498Z ##[section]Finishing: Download
2020-06-15T12:16:05.3893746Z ##[section]Starting: IIS Web App Manage
2020-06-15T12:16:05.4111059Z ==============================================================================
2020-06-15T12:16:05.4111422Z Task : IIS web app manage
2020-06-15T12:16:05.4111762Z Description : Create or update websites, web apps, virtual directories, or application pools
2020-06-15T12:16:05.4114396Z Version : 0.5.15
2020-06-15T12:16:05.4114757Z Author : Microsoft Corporation
2020-06-15T12:16:05.4115193Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group
2020-06-15T12:16:05.4115883Z ==============================================================================
2020-06-15T12:16:09.1901004Z ##[command]"C:\windows\system32\inetsrv\appcmd.exe" list site /name:"Default Web Site"
2020-06-15T12:16:09.7275643Z
2020-06-15T12:16:09.7277066Z
2020-06-15T12:16:09.7282874Z Directory: C:\inetpub\wwwroot
2020-06-15T12:16:09.7285603Z
2020-06-15T12:16:09.7286457Z
2020-06-15T12:16:09.7305926Z Mode LastWriteTime Length Name
2020-06-15T12:16:09.7323105Z ---- ------------- ------ ----
2020-06-15T12:16:09.7339223Z d----- 6/15/2020 12:16 PM AspNetDemo
2020-06-15T12:16:09.7532322Z ##[command]"C:\windows\system32\inetsrv\appcmd.exe" set site /site.name:"Default Web Site" -[path='/'].[path='/'].physicalPath:"%SystemDrive%\inetpub\wwwroot\AspNetDemo" -[path='/'].[path='/'].userName: -[path='/'].[path='/'].password:
2020-06-15T12:16:10.4767779Z SITE object "Default Web Site" changed
2020-06-15T12:16:10.5022726Z
2020-06-15T12:16:10.5069765Z
2020-06-15T12:16:10.5329739Z ##[section]Finishing: IIS Web App Manage
2020-06-15T12:16:10.5548276Z ##[section]Starting: IIS Web App Deploy
2020-06-15T12:16:10.5701088Z ==============================================================================
2020-06-15T12:16:10.5701408Z Task : IIS web app deploy
2020-06-15T12:16:10.5701716Z Description : Deploy a website or web application using Web Deploy
2020-06-15T12:16:10.5701975Z Version : 0.156.13
2020-06-15T12:16:10.5702225Z Author : Microsoft Corporation
2020-06-15T12:16:10.5702612Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-deployment-on-machine-group
2020-06-15T12:16:10.5703027Z ==============================================================================
2020-06-15T12:16:12.0232544Z ConnectionString attributes in Web.config is parameterized by default. Note that the transformation has no effect on connectionString attributes as the value is overridden during deployment by 'Parameters.xml or 'SetParameters.xml' files. You can disable the auto-parameterization by setting /p:AutoParameterizationWebConfigConnectionStrings=False during MSBuild package generation.
2020-06-15T12:16:12.0631887Z [command]d:\a\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba[=13=].156.13\ctt\ctt.exe s:d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config t:d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Release.config d:d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config pw i verbose
2020-06-15T12:16:12.4770510Z Start tranformation to 'd:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config'.
2020-06-15T12:16:12.4771847Z Source file: 'd:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config'.
2020-06-15T12:16:12.4773080Z Transform file: 'd:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Release.config'.
2020-06-15T12:16:12.4774325Z Transformation task is using encoding 'System.Text.UTF8Encoding'. Change encoding in source file, or use the 'encoding' parameter if you want to change encoding.
2020-06-15T12:16:12.4775273Z Executing RemoveAttributes (transform line 18, 18)
2020-06-15T12:16:12.4776821Z on /configuration/system.web/compilation
2020-06-15T12:16:12.4777702Z Applying to 'compilation' element (no source line info)
2020-06-15T12:16:12.4778465Z Removed 'debug' attribute
2020-06-15T12:16:12.4778827Z Removed 1 attributes
2020-06-15T12:16:12.4779125Z Done executing RemoveAttributes
2020-06-15T12:16:12.4779863Z XML Transformations applied successfully
2020-06-15T12:16:12.5028504Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Debug.config
2020-06-15T12:16:12.5104251Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Debug.config
2020-06-15T12:16:12.5105110Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Dev.config
2020-06-15T12:16:12.5138107Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5157111Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Dev.config
2020-06-15T12:16:12.5158089Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Release.config
2020-06-15T12:16:12.5177323Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Release.config
2020-06-15T12:16:12.5187991Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Test.config
2020-06-15T12:16:12.5191087Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5192067Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Test.config
2020-06-15T12:16:12.5192706Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config
2020-06-15T12:16:12.5208981Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5221909Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config
2020-06-15T12:16:12.5223143Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Debug.config
2020-06-15T12:16:12.5226584Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Debug.config
2020-06-15T12:16:12.5227609Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Dev.config
2020-06-15T12:16:12.5233500Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5238472Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Dev.config
2020-06-15T12:16:12.5240963Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Release.config
2020-06-15T12:16:12.5247520Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Release.config
2020-06-15T12:16:12.5255360Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Test.config
2020-06-15T12:16:12.5285847Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5289812Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Test.config
2020-06-15T12:16:12.5293438Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\VBCSCompiler.exe.config
2020-06-15T12:16:12.5327539Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5335594Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\VBCSCompiler.exe.config
2020-06-15T12:16:12.5338157Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\csc.exe.config
2020-06-15T12:16:12.5371336Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\csc.exe.config
2020-06-15T12:16:12.5371992Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\vbc.exe.config
2020-06-15T12:16:12.5389975Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\vbc.exe.config
2020-06-15T12:16:12.5390858Z XML variable substitution applied successfully.
2020-06-15T12:16:13.6524609Z [command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='d:\a\s\temp_web_package_590126440620167.zip' -dest:auto -setParam:name='IIS Web Application Name',value='Default Web Site/AspNetDemo' -enableRule:AppOffline
2020-06-15T12:16:16.1656560Z Info: Adding sitemanifest (sitemanifest).
2020-06-15T12:16:16.3688794Z Info: Creating application (Default Web Site/AspNetDemo)
2020-06-15T12:16:16.3855513Z Info: Adding virtual path (Default Web Site/AspNetDemo)
2020-06-15T12:16:16.4371591Z Info: Adding directory (Default Web Site/AspNetDemo).
2020-06-15T12:16:16.4845399Z Info: Adding directory (Default Web Site/AspNetDemo\bin).
2020-06-15T12:16:16.4883541Z Info: Adding file (Default Web Site/AspNetDemo\bin\Demo2.dll).
2020-06-15T12:16:16.5070593Z Info: Adding file (Default Web Site/AspNetDemo\bin\Demo2.pdb).
2020-06-15T12:16:16.5080200Z Info: Adding file (Default Web Site/AspNetDemo\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll).
2020-06-15T12:16:16.5098373Z Info: Adding directory (Default Web Site/AspNetDemo\bin\roslyn).
2020-06-15T12:16:16.5109779Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csc.exe).
2020-06-15T12:16:16.5130856Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csc.exe.config).
2020-06-15T12:16:16.5139616Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csc.rsp).
2020-06-15T12:16:16.5148847Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csi.exe).
2020-06-15T12:16:16.5156562Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csi.rsp).
2020-06-15T12:16:16.5168651Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll).
2020-06-15T12:16:16.5229952Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.CSharp.dll).
2020-06-15T12:16:16.5971326Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.CSharp.Scripting.dll).
2020-06-15T12:16:16.6103919Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.dll).
2020-06-15T12:16:16.6490047Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.Scripting.dll).
2020-06-15T12:16:16.6641545Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.VisualBasic.dll).
2020-06-15T12:16:16.7788705Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CSharp.Core.targets).
2020-06-15T12:16:16.7866312Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.DiaSymReader.Native.amd64.dll).
2020-06-15T12:16:16.8908394Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.DiaSymReader.Native.x86.dll).
2020-06-15T12:16:16.9128717Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.VisualBasic.Core.targets).
2020-06-15T12:16:16.9136216Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.AppContext.dll).
2020-06-15T12:16:17.0293466Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.Collections.Immutable.dll).
2020-06-15T12:16:17.0358896Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.Diagnostics.StackTrace.dll).
2020-06-15T12:16:17.0397999Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.IO.FileSystem.dll).
2020-06-15T12:16:17.0408374Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.IO.FileSystem.Primitives.dll).
2020-06-15T12:16:17.0429135Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.Reflection.Metadata.dll).
2020-06-15T12:16:17.0508174Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\vbc.exe).
2020-06-15T12:16:17.0524962Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\vbc.exe.config).
2020-06-15T12:16:17.0537599Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\vbc.rsp).
2020-06-15T12:16:17.0544089Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\VBCSCompiler.exe).
2020-06-15T12:16:17.0567886Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\VBCSCompiler.exe.config).
2020-06-15T12:16:17.0587023Z Info: Adding file (Default Web Site/AspNetDemo\bin\Web.Debug.config).
2020-06-15T12:16:17.0657739Z Info: Adding file (Default Web Site/AspNetDemo\bin\Web.Dev.config).
2020-06-15T12:16:17.0696168Z Info: Adding file (Default Web Site/AspNetDemo\bin\Web.Release.config).
2020-06-15T12:16:17.0704103Z Info: Adding file (Default Web Site/AspNetDemo\bin\Web.Test.config).
2020-06-15T12:16:17.0711307Z Info: Adding file (Default Web Site/AspNetDemo\Default.aspx).
2020-06-15T12:16:17.0718585Z Info: Adding file (Default Web Site/AspNetDemo\Web.config).
2020-06-15T12:16:17.0737537Z Info: Adding file (Default Web Site/AspNetDemo\Web.Debug.config).
2020-06-15T12:16:17.0914599Z Info: Adding file (Default Web Site/AspNetDemo\Web.Dev.config).
2020-06-15T12:16:17.0921332Z Info: Adding file (Default Web Site/AspNetDemo\Web.Release.config).
2020-06-15T12:16:17.0928434Z Info: Adding file (Default Web Site/AspNetDemo\Web.Test.config).
2020-06-15T12:16:17.0948303Z Info: Adding ACLs for path (Default Web Site/AspNetDemo)
2020-06-15T12:16:17.1479606Z Info: Adding ACLs for path (Default Web Site/AspNetDemo)
2020-06-15T12:16:17.4606954Z Total changes: 47 (46 added, 0 deleted, 1 updated, 0 parameters changed, 14818941 bytes copied)
2020-06-15T12:16:18.3963762Z ##[section]Finishing: IIS Web App Deploy
2020-06-15T12:16:18.4137177Z ##[section]Starting: Finalize Job
2020-06-15T12:16:18.4180998Z Cleaning up task key
2020-06-15T12:16:18.4182925Z Start cleaning up orphan processes.
2020-06-15T12:16:18.4271669Z ##[section]Finishing: Finalize Job
2020-06-15T12:16:18.4320625Z ##[section]Finishing: Deploy the web application to dev environment
我注意到日志中靠近顶部的那一行 Agent machine name: 'WIN-5Q96T5JR7AD'
。这不是本地服务器的名称 运行 自托管代理,所以我认为它一定是 Microsoft 托管的代理。
通过反复试验,我找到了一个修复方法:在 Deploy 阶段,为环境指定 resourceType。
在部署阶段,环境信息是:
environment: Dev
现在变成:
environment:
name: Dev
resourceType: VirtualMachine
我不知道为什么需要指定 resourceType,或者这是否是一个问题,并且有更优雅的方法来解决这个问题。但是,管道现在始终如一地工作。
环境是资源的集合,可以通过管道进行部署。环境可以包括 Kubernetes 集群、Azure Web 应用程序、虚拟机、数据库。
换句话说,需要告诉管道你要部署到哪个资源。在您的情况下应该是虚拟机。 (因为您已经提到您使用虚拟机资源创建了一个环境。)
在管道 YAML 中引用环境和 VM 资源的示例。 .
jobs:
- deployment: VMDeploy
displayName: web
environment:
name: VMenv
resourceType: VirtualMachine
tags: web1
strategy:
更多详情请参考我们的官方教程--Environment - virtual machine resource
在您的情况下,您只需指定一个环境,部署作业用于针对整个环境。
并且您已指定 pool: vmImage: 'windows-latest'
,因此部署作业最终针对包含 windows-最新 vmImage 的主机代理池,而不是您创建的 VM 资源。
这就是部署作业实际上 运行 在 Microsoft 托管代理而不是自托管代理上的原因。
我正在尝试创建概念验证,将 ASP.NET 网络应用程序(.NET Framework,而非 .NET Core)部署到本地 Windows 服务器 运行 IIS.
我使用基于 YAML 的构建管道和使用经典 GUI 的发布管道让它工作。为了部署到本地服务器,我创建了一个部署组并将一个自托管代理部署到目标服务器。工作正常。
我的下一步是尝试创建一个基于 YAML 的多阶段管道,将构建管道转换为构建阶段并编写一个 b运行d 新部署阶段。据我了解,YAML 多级管道不支持部署组,因此我必须创建一个具有虚拟机资源的环境。我在目标服务器上创建了代理并将其自身注册为环境下的资源,因此设置看起来不错。在这种情况下,环境被命名为 "Dev".
我尝试了 运行 管道,它似乎工作正常,成功完成。日志显示部署阶段下载了在构建阶段创建的工件,IIS Web App Manage 和 IIS Web App Deploy 步骤 运行 正常。但是,目标服务器上的 Web 应用程序未更新。 Dev 环境下的资源,代表目标服务器,也显示 "Never deployed" 为最新作业,表明自托管代理从未下载过版本。
我假设由于日志没有显示错误,所以部署作业实际上是 运行 在 Microsoft 托管的代理而不是自托管代理上。鉴于 Dev 环境以自托管代理作为其唯一资源存在,我看不出我哪里出错了。关于我哪里出错的任何提示或建议?
这是完整的 YAML 文件:
trigger:
- '*'
stages:
- stage: 'Build'
displayName: 'Build the web application'
jobs:
- job: 'Build'
displayName: 'Build job'
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:TransformWebConfigEnabled=false /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- stage: 'Deploy'
displayName: 'Deploy the web application'
dependsOn: Build
jobs:
- deployment: 'DeployToDev'
displayName: 'Deploy the web application to dev environment'
pool:
vmImage: 'windows-latest'
variables:
Parameters.IISDeploymentType: 'IISWebsite'
Parameters.ActionIISWebsite: 'CreateOrUpdateWebsite'
Parameters.WebsiteName: 'Default Web Site'
Parameters.WebsitePhysicalPath: '%SystemDrive%\inetpub\wwwroot\AspNetDemo'
Parameters.AddBinding: false
Parameters.VirtualPathForApplication: '/AspNetDemo'
Parameters.AppPoolName: ''
Parameters.VirtualApplication: 'AspNetDemo'
Parameters.Package: '$(Pipeline.Workspace)\drop\*.zip'
Parameters.RemoveAdditionalFilesFlag: true
Parameters.TakeAppOfflineFlag: true
Parameters.XmlTransformation: true
Parameters.XmlVariableSubstitution: true
environment: Dev
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop
- task: IISWebAppManagementOnMachineGroup@0
displayName: 'IIS Web App Manage'
inputs:
IISDeploymentType: '$(Parameters.IISDeploymentType)'
ActionIISWebsite: '$(Parameters.ActionIISWebsite)'
WebsiteName: '$(Parameters.WebsiteName)'
WebsitePhysicalPath: '$(Parameters.WebsitePhysicalPath)'
AddBinding: $(Parameters.AddBinding)
ParentWebsiteNameForVD: '$(Parameters.WebsiteName)'
VirtualPathForVD: '$(Parameters.VirtualPathForApplication)'
ParentWebsiteNameForApplication: '$(Parameters.WebsiteName)'
VirtualPathForApplication: '$(Parameters.VirtualPathForApplication)'
AppPoolName: '$(Parameters.AppPoolName)'
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
inputs:
WebSiteName: '$(Parameters.WebsiteName)'
VirtualApplication: '$(Parameters.VirtualApplication)'
Package: '$(Parameters.Package)'
RemoveAdditionalFilesFlag: $(Parameters.RemoveAdditionalFilesFlag)
TakeAppOfflineFlag: $(Parameters.TakeAppOfflineFlag)
XmlTransformation: $(Parameters.XmlTransformation)
XmlVariableSubstitution: $(Parameters.XmlVariableSubstitution)
下面是部署阶段的原始日志文件:
2020-06-15T12:15:56.9858347Z ##[section]Starting: Deploy the web application to dev environment
2020-06-15T12:15:57.1573499Z ##[section]Starting: Initialize job
2020-06-15T12:15:57.1574831Z Agent name: 'Hosted Agent'
2020-06-15T12:15:57.1575185Z Agent machine name: 'WIN-5Q96T5JR7AD'
2020-06-15T12:15:57.1575401Z Current agent version: '2.170.1'
2020-06-15T12:15:57.1593854Z Current image version: '20200531.1'
2020-06-15T12:15:57.1601179Z Agent running as: 'VssAdministrator'
2020-06-15T12:15:57.1656829Z Prepare build directory.
2020-06-15T12:15:57.2207188Z Set build variables.
2020-06-15T12:15:57.2242403Z Download all required tasks.
2020-06-15T12:15:57.2403517Z Downloading task: DownloadBuildArtifacts (0.167.2)
2020-06-15T12:15:58.7871306Z Downloading task: IISWebAppManagementOnMachineGroup (0.5.15)
2020-06-15T12:15:58.8604155Z Downloading task: IISWebAppDeploymentOnMachineGroup (0.156.13)
2020-06-15T12:16:00.2584106Z Checking job knob settings.
2020-06-15T12:16:00.2595245Z Knob: AgentToolsDirectory = C:/hostedtoolcache/windows Source: ${AGENT_TOOLSDIRECTORY}
2020-06-15T12:16:00.2596590Z Knob: AgentPerflog = c:\agents\perflog Source: ${VSTS_AGENT_PERFLOG}
2020-06-15T12:16:00.2597479Z Finished checking job knob settings.
2020-06-15T12:16:00.2963001Z Start tracking orphan processes.
2020-06-15T12:16:00.3045878Z ##[section]Finishing: Initialize job
2020-06-15T12:16:00.3715796Z ##[section]Starting: Download
2020-06-15T12:16:00.4732035Z ==============================================================================
2020-06-15T12:16:00.4732834Z Task : Download build artifacts
2020-06-15T12:16:00.4733443Z Description : Download files that were saved as artifacts of a completed build
2020-06-15T12:16:00.4733725Z Version : 0.167.2
2020-06-15T12:16:00.4734218Z Author : Microsoft Corporation
2020-06-15T12:16:00.4734834Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/download-build-artifacts
2020-06-15T12:16:00.4735229Z ==============================================================================
2020-06-15T12:16:02.4240789Z Downloading artifacts for build: 206
2020-06-15T12:16:02.4263144Z Downloading items from container resource #/7981806/drop
2020-06-15T12:16:02.4263938Z Downloading artifact drop from: https://dev.azure.com/SimonE0675//_apis/resources/Containers/7981806?itemPath=drop&isShallow=true&api-version=4.1-preview.4
2020-06-15T12:16:02.4268251Z Downloading drop/AspNetDemo.deploy-readme.txt to d:\a\drop\AspNetDemo.deploy-readme.txt
2020-06-15T12:16:02.8224843Z Downloading drop/AspNetDemo.deploy.cmd to d:\a\drop\AspNetDemo.deploy.cmd
2020-06-15T12:16:02.8547084Z Downloading drop/AspNetDemo.SetParameters.xml to d:\a\drop\AspNetDemo.SetParameters.xml
2020-06-15T12:16:03.4437009Z Downloading drop/AspNetDemo.SourceManifest.xml to d:\a\drop\AspNetDemo.SourceManifest.xml
2020-06-15T12:16:03.4495772Z Downloading drop/AspNetDemo.zip to d:\a\drop\AspNetDemo.zip
2020-06-15T12:16:03.4516280Z Downloaded drop/AspNetDemo.deploy-readme.txt to d:\a\drop\AspNetDemo.deploy-readme.txt
2020-06-15T12:16:03.4523121Z Downloaded drop/AspNetDemo.SetParameters.xml to d:\a\drop\AspNetDemo.SetParameters.xml
2020-06-15T12:16:03.4525288Z Downloaded drop/AspNetDemo.deploy.cmd to d:\a\drop\AspNetDemo.deploy.cmd
2020-06-15T12:16:03.4561228Z Downloaded drop/AspNetDemo.SourceManifest.xml to d:\a\drop\AspNetDemo.SourceManifest.xml
2020-06-15T12:16:03.8676511Z Downloaded drop/AspNetDemo.zip to d:\a\drop\AspNetDemo.zip
2020-06-15T12:16:04.8013454Z Total Files: 5, Processed: 5, Skipped: 0, Failed: 0, Download time: 3.039 secs, Download size: 5.572MB
2020-06-15T12:16:05.3818312Z Successfully downloaded artifacts to d:\a/
2020-06-15T12:16:05.3852498Z ##[section]Finishing: Download
2020-06-15T12:16:05.3893746Z ##[section]Starting: IIS Web App Manage
2020-06-15T12:16:05.4111059Z ==============================================================================
2020-06-15T12:16:05.4111422Z Task : IIS web app manage
2020-06-15T12:16:05.4111762Z Description : Create or update websites, web apps, virtual directories, or application pools
2020-06-15T12:16:05.4114396Z Version : 0.5.15
2020-06-15T12:16:05.4114757Z Author : Microsoft Corporation
2020-06-15T12:16:05.4115193Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group
2020-06-15T12:16:05.4115883Z ==============================================================================
2020-06-15T12:16:09.1901004Z ##[command]"C:\windows\system32\inetsrv\appcmd.exe" list site /name:"Default Web Site"
2020-06-15T12:16:09.7275643Z
2020-06-15T12:16:09.7277066Z
2020-06-15T12:16:09.7282874Z Directory: C:\inetpub\wwwroot
2020-06-15T12:16:09.7285603Z
2020-06-15T12:16:09.7286457Z
2020-06-15T12:16:09.7305926Z Mode LastWriteTime Length Name
2020-06-15T12:16:09.7323105Z ---- ------------- ------ ----
2020-06-15T12:16:09.7339223Z d----- 6/15/2020 12:16 PM AspNetDemo
2020-06-15T12:16:09.7532322Z ##[command]"C:\windows\system32\inetsrv\appcmd.exe" set site /site.name:"Default Web Site" -[path='/'].[path='/'].physicalPath:"%SystemDrive%\inetpub\wwwroot\AspNetDemo" -[path='/'].[path='/'].userName: -[path='/'].[path='/'].password:
2020-06-15T12:16:10.4767779Z SITE object "Default Web Site" changed
2020-06-15T12:16:10.5022726Z
2020-06-15T12:16:10.5069765Z
2020-06-15T12:16:10.5329739Z ##[section]Finishing: IIS Web App Manage
2020-06-15T12:16:10.5548276Z ##[section]Starting: IIS Web App Deploy
2020-06-15T12:16:10.5701088Z ==============================================================================
2020-06-15T12:16:10.5701408Z Task : IIS web app deploy
2020-06-15T12:16:10.5701716Z Description : Deploy a website or web application using Web Deploy
2020-06-15T12:16:10.5701975Z Version : 0.156.13
2020-06-15T12:16:10.5702225Z Author : Microsoft Corporation
2020-06-15T12:16:10.5702612Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-deployment-on-machine-group
2020-06-15T12:16:10.5703027Z ==============================================================================
2020-06-15T12:16:12.0232544Z ConnectionString attributes in Web.config is parameterized by default. Note that the transformation has no effect on connectionString attributes as the value is overridden during deployment by 'Parameters.xml or 'SetParameters.xml' files. You can disable the auto-parameterization by setting /p:AutoParameterizationWebConfigConnectionStrings=False during MSBuild package generation.
2020-06-15T12:16:12.0631887Z [command]d:\a\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba[=13=].156.13\ctt\ctt.exe s:d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config t:d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Release.config d:d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config pw i verbose
2020-06-15T12:16:12.4770510Z Start tranformation to 'd:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config'.
2020-06-15T12:16:12.4771847Z Source file: 'd:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config'.
2020-06-15T12:16:12.4773080Z Transform file: 'd:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Release.config'.
2020-06-15T12:16:12.4774325Z Transformation task is using encoding 'System.Text.UTF8Encoding'. Change encoding in source file, or use the 'encoding' parameter if you want to change encoding.
2020-06-15T12:16:12.4775273Z Executing RemoveAttributes (transform line 18, 18)
2020-06-15T12:16:12.4776821Z on /configuration/system.web/compilation
2020-06-15T12:16:12.4777702Z Applying to 'compilation' element (no source line info)
2020-06-15T12:16:12.4778465Z Removed 'debug' attribute
2020-06-15T12:16:12.4778827Z Removed 1 attributes
2020-06-15T12:16:12.4779125Z Done executing RemoveAttributes
2020-06-15T12:16:12.4779863Z XML Transformations applied successfully
2020-06-15T12:16:12.5028504Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Debug.config
2020-06-15T12:16:12.5104251Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Debug.config
2020-06-15T12:16:12.5105110Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Dev.config
2020-06-15T12:16:12.5138107Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5157111Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Dev.config
2020-06-15T12:16:12.5158089Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Release.config
2020-06-15T12:16:12.5177323Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Release.config
2020-06-15T12:16:12.5187991Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Test.config
2020-06-15T12:16:12.5191087Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5192067Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.Test.config
2020-06-15T12:16:12.5192706Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config
2020-06-15T12:16:12.5208981Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5221909Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\Web.config
2020-06-15T12:16:12.5223143Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Debug.config
2020-06-15T12:16:12.5226584Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Debug.config
2020-06-15T12:16:12.5227609Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Dev.config
2020-06-15T12:16:12.5233500Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5238472Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Dev.config
2020-06-15T12:16:12.5240963Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Release.config
2020-06-15T12:16:12.5247520Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Release.config
2020-06-15T12:16:12.5255360Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Test.config
2020-06-15T12:16:12.5285847Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5289812Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\Web.Test.config
2020-06-15T12:16:12.5293438Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\VBCSCompiler.exe.config
2020-06-15T12:16:12.5327539Z Processing substitution for xml node : appSettings
2020-06-15T12:16:12.5335594Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\VBCSCompiler.exe.config
2020-06-15T12:16:12.5338157Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\csc.exe.config
2020-06-15T12:16:12.5371336Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\csc.exe.config
2020-06-15T12:16:12.5371992Z Initiated variable substitution in config file : d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\vbc.exe.config
2020-06-15T12:16:12.5389975Z Skipped Updating file: d:\a\_temp\temp_web_package_9405406238180971\Content\d_C\a\s\AspNetDemo\obj\Release\Package\PackageTmp\bin\roslyn\vbc.exe.config
2020-06-15T12:16:12.5390858Z XML variable substitution applied successfully.
2020-06-15T12:16:13.6524609Z [command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='d:\a\s\temp_web_package_590126440620167.zip' -dest:auto -setParam:name='IIS Web Application Name',value='Default Web Site/AspNetDemo' -enableRule:AppOffline
2020-06-15T12:16:16.1656560Z Info: Adding sitemanifest (sitemanifest).
2020-06-15T12:16:16.3688794Z Info: Creating application (Default Web Site/AspNetDemo)
2020-06-15T12:16:16.3855513Z Info: Adding virtual path (Default Web Site/AspNetDemo)
2020-06-15T12:16:16.4371591Z Info: Adding directory (Default Web Site/AspNetDemo).
2020-06-15T12:16:16.4845399Z Info: Adding directory (Default Web Site/AspNetDemo\bin).
2020-06-15T12:16:16.4883541Z Info: Adding file (Default Web Site/AspNetDemo\bin\Demo2.dll).
2020-06-15T12:16:16.5070593Z Info: Adding file (Default Web Site/AspNetDemo\bin\Demo2.pdb).
2020-06-15T12:16:16.5080200Z Info: Adding file (Default Web Site/AspNetDemo\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll).
2020-06-15T12:16:16.5098373Z Info: Adding directory (Default Web Site/AspNetDemo\bin\roslyn).
2020-06-15T12:16:16.5109779Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csc.exe).
2020-06-15T12:16:16.5130856Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csc.exe.config).
2020-06-15T12:16:16.5139616Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csc.rsp).
2020-06-15T12:16:16.5148847Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csi.exe).
2020-06-15T12:16:16.5156562Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\csi.rsp).
2020-06-15T12:16:16.5168651Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll).
2020-06-15T12:16:16.5229952Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.CSharp.dll).
2020-06-15T12:16:16.5971326Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.CSharp.Scripting.dll).
2020-06-15T12:16:16.6103919Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.dll).
2020-06-15T12:16:16.6490047Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.Scripting.dll).
2020-06-15T12:16:16.6641545Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CodeAnalysis.VisualBasic.dll).
2020-06-15T12:16:16.7788705Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.CSharp.Core.targets).
2020-06-15T12:16:16.7866312Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.DiaSymReader.Native.amd64.dll).
2020-06-15T12:16:16.8908394Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.DiaSymReader.Native.x86.dll).
2020-06-15T12:16:16.9128717Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\Microsoft.VisualBasic.Core.targets).
2020-06-15T12:16:16.9136216Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.AppContext.dll).
2020-06-15T12:16:17.0293466Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.Collections.Immutable.dll).
2020-06-15T12:16:17.0358896Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.Diagnostics.StackTrace.dll).
2020-06-15T12:16:17.0397999Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.IO.FileSystem.dll).
2020-06-15T12:16:17.0408374Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.IO.FileSystem.Primitives.dll).
2020-06-15T12:16:17.0429135Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\System.Reflection.Metadata.dll).
2020-06-15T12:16:17.0508174Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\vbc.exe).
2020-06-15T12:16:17.0524962Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\vbc.exe.config).
2020-06-15T12:16:17.0537599Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\vbc.rsp).
2020-06-15T12:16:17.0544089Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\VBCSCompiler.exe).
2020-06-15T12:16:17.0567886Z Info: Adding file (Default Web Site/AspNetDemo\bin\roslyn\VBCSCompiler.exe.config).
2020-06-15T12:16:17.0587023Z Info: Adding file (Default Web Site/AspNetDemo\bin\Web.Debug.config).
2020-06-15T12:16:17.0657739Z Info: Adding file (Default Web Site/AspNetDemo\bin\Web.Dev.config).
2020-06-15T12:16:17.0696168Z Info: Adding file (Default Web Site/AspNetDemo\bin\Web.Release.config).
2020-06-15T12:16:17.0704103Z Info: Adding file (Default Web Site/AspNetDemo\bin\Web.Test.config).
2020-06-15T12:16:17.0711307Z Info: Adding file (Default Web Site/AspNetDemo\Default.aspx).
2020-06-15T12:16:17.0718585Z Info: Adding file (Default Web Site/AspNetDemo\Web.config).
2020-06-15T12:16:17.0737537Z Info: Adding file (Default Web Site/AspNetDemo\Web.Debug.config).
2020-06-15T12:16:17.0914599Z Info: Adding file (Default Web Site/AspNetDemo\Web.Dev.config).
2020-06-15T12:16:17.0921332Z Info: Adding file (Default Web Site/AspNetDemo\Web.Release.config).
2020-06-15T12:16:17.0928434Z Info: Adding file (Default Web Site/AspNetDemo\Web.Test.config).
2020-06-15T12:16:17.0948303Z Info: Adding ACLs for path (Default Web Site/AspNetDemo)
2020-06-15T12:16:17.1479606Z Info: Adding ACLs for path (Default Web Site/AspNetDemo)
2020-06-15T12:16:17.4606954Z Total changes: 47 (46 added, 0 deleted, 1 updated, 0 parameters changed, 14818941 bytes copied)
2020-06-15T12:16:18.3963762Z ##[section]Finishing: IIS Web App Deploy
2020-06-15T12:16:18.4137177Z ##[section]Starting: Finalize Job
2020-06-15T12:16:18.4180998Z Cleaning up task key
2020-06-15T12:16:18.4182925Z Start cleaning up orphan processes.
2020-06-15T12:16:18.4271669Z ##[section]Finishing: Finalize Job
2020-06-15T12:16:18.4320625Z ##[section]Finishing: Deploy the web application to dev environment
我注意到日志中靠近顶部的那一行 Agent machine name: 'WIN-5Q96T5JR7AD'
。这不是本地服务器的名称 运行 自托管代理,所以我认为它一定是 Microsoft 托管的代理。
通过反复试验,我找到了一个修复方法:在 Deploy 阶段,为环境指定 resourceType。
在部署阶段,环境信息是:
environment: Dev
现在变成:
environment:
name: Dev
resourceType: VirtualMachine
我不知道为什么需要指定 resourceType,或者这是否是一个问题,并且有更优雅的方法来解决这个问题。但是,管道现在始终如一地工作。
环境是资源的集合,可以通过管道进行部署。环境可以包括 Kubernetes 集群、Azure Web 应用程序、虚拟机、数据库。
换句话说,需要告诉管道你要部署到哪个资源。在您的情况下应该是虚拟机。 (因为您已经提到您使用虚拟机资源创建了一个环境。)
在管道 YAML 中引用环境和 VM 资源的示例。 .
jobs:
- deployment: VMDeploy
displayName: web
environment:
name: VMenv
resourceType: VirtualMachine
tags: web1
strategy:
更多详情请参考我们的官方教程--Environment - virtual machine resource
在您的情况下,您只需指定一个环境,部署作业用于针对整个环境。
并且您已指定 pool: vmImage: 'windows-latest'
,因此部署作业最终针对包含 windows-最新 vmImage 的主机代理池,而不是您创建的 VM 资源。
这就是部署作业实际上 运行 在 Microsoft 托管代理而不是自托管代理上的原因。