期望的状态配置xWebsite启动异常获取"项目":"索引超出了数组的范围。"

时间:2015-11-25 11:31:09

标签: powershell dsc

情况如下,如果我的网站处于停止状态并尝试使用DSC启动网站,那么我第一次应用配置时会遇到很多错误。 (Windows 10机器,未在Windows服务器机器上测试过)

配置确实成功了,因为如果我发出第二次运行它会起作用,并且它会被跳过,因为站点已处于所需状态

这是配置

    xWebsite JarvisAvatarServiceWebSite
    {
        Ensure = "Present"
        Name = "JarvisAvatarService"
        PhysicalPath = $WebSitePath
        State = "Started"
        ApplicationPool = "DefaultAppPool"
        BindingInfo     = MSFT_xWebBindingInformation 
            { 
                Protocol              = "HTTP" 
                Port                  = $WebSitePort  
            } 
    }

任何人都知道为什么会发生这种情况?

这是一段日志

    PS Z:\temp\jsetup> Start-DscConfiguration -Wait -Verbose -Force -Path ".\JarvisAvatarServiceWebSite]
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' =
SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer AIDORU with user sid S-1-5-21-3306090501-4088681542-3160041106-1000.
VERBOSE: [AIDORU]: LCM:  [ Start  Set      ]
VERBOSE: [AIDORU]: LCM:  [ Start  Resource ]  [[xWebsite]JarvisAvatarServiceWebSite]
VERBOSE: [AIDORU]: LCM:  [ Start  Test     ]  [[xWebsite]JarvisAvatarServiceWebSite]
VERBOSE: [AIDORU]:                            [[xWebsite]JarvisAvatarServiceWebSite] The state of Website
JarvisAvatarService does not match the desired state.
VERBOSE: [AIDORU]: LCM:  [ End    Test     ]  [[xWebsite]JarvisAvatarServiceWebSite]  in 0.0850 seconds.
VERBOSE: [AIDORU]: LCM:  [ Start  Set      ]  [[xWebsite]JarvisAvatarServiceWebSite]
Exception getting "Item": "Index was outside the bounds of the array."
    + CategoryInfo          : NotSpecified: (:) [], CimException
    + FullyQualifiedErrorId : ExceptionWhenGetting
    + PSComputerName        : AIDORU

...Lots of other errors omitted.

VERBOSE: [AIDORU]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : AIDORU

VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.754 seconds

...Now I invoke the very same configuration again and it suceeds because everything is in desired state

PS Z:\temp\jsetup> Start-DscConfiguration -Wait -Verbose -Force -Path ".\JarvisAvatarServiceWebSiteStarted"
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' =
SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer AIDORU with user sid S-1-5-21-3306090501-4088681542-3160041106-1000.
VERBOSE: [AIDORU]: LCM:  [ Start  Set      ]
VERBOSE: [AIDORU]: LCM:  [ Start  Resource ]  [[xWebsite]JarvisAvatarServiceWebSite]
VERBOSE: [AIDORU]: LCM:  [ Start  Test     ]  [[xWebsite]JarvisAvatarServiceWebSite]
VERBOSE: [AIDORU]: LCM:  [ End    Test     ]  [[xWebsite]JarvisAvatarServiceWebSite]  in 0.0580 seconds.
VERBOSE: [AIDORU]: LCM:  [ Skip   Set      ]  [[xWebsite]JarvisAvatarServiceWebSite]
VERBOSE: [AIDORU]: LCM:  [ End    Resource ]  [[xWebsite]JarvisAvatarServiceWebSite]
VERBOSE: [AIDORU]: LCM:  [ End    Set      ]
VERBOSE: [AIDORU]: LCM:  [ End    Set      ]    in  0.1100 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.159 seconds

0 个答案:

没有答案