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

謝謝。 它對我來說工作得很好。 –

相關問題