3

网站和泳池我有我安装使用AWS Codedeploy到运行Windows Server 2012 R2与代码部署代理EC2实例中部署的应用程序。AWS CodeDeploy PowerShell脚本未能在IIS中创建服务器

的代码修改成功地从S3斗下载到EC2实例,但PowerShell脚本抛出错误。

只是为了告知,执行在EC2实例脚本手动将其成功运行的时候。

这里是我的appspec.yml &之前,INSTALL.BAT

  • appspec.yml

    version: 0.0 os: windows files: - source: \index.html destination: C:\DemoApp\MySite hooks: BeforeInstall: - location: \before-install.bat timeout: 900

  • 之前,INSTALL.BAT

    C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -Command "& {Import-Module WebAdministration; New-Item iis:\Sites\MySite -bindings @{protocol=\"http\";bindingInformation=\":80:\"} -physicalPath c:\DemoApp\MySite; New-Item IIS:\AppPools\MyPool; Set-ItemProperty IIS:\Sites\MySite -name applicationPool -value MyPool;}"

codedeploy代理-deployments.log

脚本 - \之前,INSTALL.BAT C:\ Windows \ System32下> C:\ WINDOWS \ SYSTEM32 \ WindowsPowerShell \ V1.0 \ powershell.exe -Command“& {Set-ExecutionPolicy Unrestricted;导入模块Web管理;新建项目IIS:\网站\ mysite的-Bindings @ {协议= \ “HTTP \”; bindingInformation = \ “:80:\”} -physicalPath C:\ DemoApp \ mysite的; New-Item IIS:\ AppPools \ MyPool; Set-ItemProperty IIS:\ Sites \ MySite -name applicationPool -value MyPool;}“ New-Item:无法检索该cmdlet的动态参数检索 CLSID组件的COM类工厂 {688EEEE5-6A7E-422F- B2E1-6AF00DC944A6}失败,原因是以下错误: 80040154类未注册(从HRESULT异常:0x80040154的 (REGDB_E_CLASSNOTREG)) 在行:1个字符:71 + & {SET-ExecutionPolicy不受限制;导入模块WebAdministration; 新建项目我... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ + CategoryInfo:InvalidArgument:(:) [New-Item],ParameterBind在 gException + FullyQualifiedErrorId:GetDynamicParametersException,Microsoft.PowerShe ll.Commands.NewItemCommand

回答

3

试试这个脚本:

如果($ PSHome的样 “SysWOW64中”) { 写警告“重新启动这个脚本在64位的Windows PowerShell。”

&(联接路径($ PSHome的-replace “Syswow64资料”, “SysNative”)powershell.exe) - 文件` (联接路径$ PSScriptRoot $ MyInvocatio ñ。mycommand的)@args

退出$ LastExitCode }

导入模块WebAdministration; New-Item IIS:\ AppPools \ MyPool; New-Item iis:\ Sites \ MySite -bindings @ {protocol ='http'; bindingInformation =':80:'} -physicalPath c:\ DemoApp \ MySite; Set-ItemProperty IIS:\ Sites \ MySite -name applicationPool -value MyPool

请参阅:http://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting-deployments.html

+0

谢谢。 它对我来说工作得很好。 –

相关问题