Powershell 所需状态配置xWebsite启动异常获取“;项目";:&引用;索引超出了数组的边界。”;

Powershell 所需状态配置xWebsite启动异常获取“;项目";:&引用;索引超出了数组的边界。”;,powershell,dsc,Powershell,Dsc,情况如下,如果我有一个网站处于停止状态,并尝试使用DSC启动该网站,则在第一次应用配置时会出现很多错误。(Windows 10计算机,未在Windows server计算机中测试) 配置确实成功了,因为如果我再次运行它,它就会工作,并且会被跳过,因为站点已经处于所需的状态 这里是配置 xWebsite JarvisAvatarServiceWebSite { Ensure = "Present" Name = "JarvisAvatarServic

情况如下,如果我有一个网站处于停止状态,并尝试使用DSC启动该网站,则在第一次应用配置时会出现很多错误。(Windows 10计算机,未在Windows server计算机中测试)

配置确实成功了,因为如果我再次运行它,它就会工作,并且会被跳过,因为站点已经处于所需的状态

这里是配置

    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

您在使用最新的xWebAdministration模块时仍会遇到此错误吗?事实上,我已使用某些powershell替换了xWebAdministration模块,我需要使用最新版本重试。您在使用最新的xWebAdministration模块时仍会遇到此错误吗?事实上,我已使用某些powershell替换了xWebAdministration模块,我需要使用最新版本重试。