简体   繁体   English

调用Msdeploy时,AWS Code Deploy失败

[英]AWS Code Deploy Fails When Calling Msdeploy

I'm working on setting up our build process to utilize AWS code deploy with an autoscaling group. 我正在设置构建过程以利用自动缩放组的AWS代码部署。 I've managed to get the code built and zipped with an appspec.yml and BeforeInstall.bat file all moved up to S3 correctly. 我已经设法使用appspec.yml和BeforeInstall.bat文件构建和压缩代码,所有文件都正确地移动到S3。 Code deploy properly pulls down the zip file, unzips it and calls the BeforeInstall.bat. 代码部署正确拉下zip文件,解压缩并调用BeforeInstall.bat。 The batch file has 3 steps 批处理文件有3个步骤

  1. Stop an app pool 停止应用程序池
  2. Stop a website 停止一个网站
  3. Call website.deploy.cmd 请致电website.deploy.cmd

It properly gets through steps 1 and 2, but then when it gets to step 3 it calls msdeploy and returns this error: 它正确地完成了第1步和第2步,但是当它到达第3步时,它调用msdeploy并返回此错误:

Error: There was an error reading IIS configuration schema from 'C:\\Windows\\system32\\inetsrv\\config\\schema\\'

Thinking that it's likely a permission issue, I logged onto one of the servers and ran the cmd script manually. 认为这可能是权限问题,我登录到其中一个服务器并手动运行cmd脚本。 It deploys fine, which isn't surprising given that I logged on as an Admin. 它部署很好,这并不奇怪,因为我以管理员身份登录。 I then opened a powershell script as the LocalSystem user (which is what the CodeDeploy Host Agent Service runs as) and ran the cmd script. 然后我打开了一个PowerShell脚本作为LocalSystem用户(这是CodeDeploy Host Agent Service运行的CodeDeploy Host Agent Service )并运行cmd脚本。 It completed successfully. 它成功完成。 I ran the whole batch file as the LocalSystem user. 我将整个批处理文件作为LocalSystem用户运行。 It ran successfully. 它运行成功。

I then went back and added echo %username% to the batch script, committed, built, and ran a new deployment. 然后我返回并将echo %username%添加到批处理脚本,提交,构建并运行新部署。 I see this user in the code deploy logs WIN-49GNL2FRHJ4$ . 我在代码中看到这个用户部署日志WIN-49GNL2FRHJ4$ The deployment still fails. 部署仍然失败。 When I run the batch script on the box from a powershell window as Administrator , I of course see Administrator echoed out. 当我以Administrator身份从powershell窗口运行该框上的批处理脚本时,我当然看到Administrator回应了。 The script succeeds. 脚本成功。 When I run the batch script from a powershell window as the LocalSystem I see WIN-49GNL2FRHJ4$ , just as when it's run from CodeDeploy via the AWS console, but it successfully runs. 当我从powershell窗口运行批处理脚本作为LocalSystem我看到WIN-49GNL2FRHJ4$ ,就像它通过AWS控制台从CodeDeploy运行一样,但它成功运行。

What is different between how the AWS console calls that batch file as the LocalSystem user and how I call it as that user via a powershell window? AWS控制台如何将该批处理文件作为LocalSystem用户调用以及如何通过PowerShell窗口将其作为该用户调用,这有何不同?

Looks like the issue was having an old version of Web Deploy installed. 看起来问题是安装了旧版本的Web Deploy。 I went to look for logs and realized that I had somehow installed v2 (probably the default when I installed IIS onto the EC2 instance). 我去寻找日志并意识到我已经以某种方式安装了v2(可能是我将IIS安装到EC2实例时的默认设置)。 I downloaded and installed the latest version (v 3.6 as of this writing) and created a new deploy. 我下载并安装了最新版本(撰写本文时为v 3.6)并创建了一个新部署。 The code deployed as expected. 代码按预期部署。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM