简体   繁体   English

所需状态配置xWebsite

[英]Desired State Configuration xWebsite

I am running into a problem. 我遇到了问题。 When I go to create a website I get an error. 当我创建网站时,出现错误。 Has anyone else ever ran into this issue? 有没有其他人遇到过这个问题?

VERBOSE: [CONT10SQLTEST]: [[xWebsite]CMSAuth] Physical Path of Website CMSAuth does not match the desired state. 详细信息:[CONT10SQLTEST]:[[xWebsite] CMSAuth]网站CMSAuth的物理路径与所需状态不匹配。 Cannot find path 'IIS:\\Sites\\CMSAuth' because it does not exist. 找不到路径“ IIS:\\ Sites \\ CMSAuth”,因为它不存在。 + CategoryInfo : ObjectNotFound: (IIS:\\Sites\\CMSAuth:) [], CimException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand + PSComputerName : CONT10SQLTEST + CategoryInfo:ObjectNotFound:(IIS:\\ Sites \\ CMSAuth :) [],CimException + FullyQualifiedErrorId:PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand + PSComputerName:CONT10SQLTEST

VERBOSE: [CONT10SQLTEST]: LCM: [ End Test ] [[xWebsite]CMSAuth] in 1.9830 seconds. 详细信息:[CONT10SQLTEST]:LCM:[最终测试] [[xWebsite] CMSAuth]在1.9830秒内。 The PowerShell provider MSFT_xWebsite threw one or more non-terminating errors while running the Test-TargetResource functionality. PowerShell提供程序MSFT_xWebsite在运行Test-TargetResource功能时引发了一个或多个非终止错误。 These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. 这些错误记录到称为Microsoft-Windows-DSC / Operational的ETW通道。 Refer to this channel for more details. 有关更多详细信息,请参考此频道。 + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : NonTerminatingErrorFromProvider + PSComputerName : CONT10SQLTEST + CategoryInfo:InvalidOperation:(:) [],CimException + FullyQualifiedErrorId:NonTerminateErrorFromProvider + PSComputerName:CONT10SQLTEST

VERBOSE: [CONT10SQLTEST]: LCM: [ End Set ] The SendConfigurationApply function did not succeed. 详细信息:[CONT10SQLTEST]:LCM:[结束集] SendConfigurationApply函数未成功。 + CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : MI RESULT 1 + PSComputerName : CONT10SQLTEST + CategoryInfo:未指定:(root / Microsoft / ... gurationManager:String)[],CimException + FullyQualifiedErrorId:MI RESULT 1 + PSComputerName:CONT10SQLTEST

configuration iis
{
     node $env:computername
     {

          xWebsite CMSAuth
          {
               Ensure = "Present"
               Name = "CMSAuth"
               State = "Started"
               ApplicationPool = "CMSAuthAppPool"
               PhysicalPath = "E:\websites\CMSAuth\Website"
               BindingInfo = MSFT_xWebBindingInformation
                        {
                            Protocol = "HTTP"
                            Port = 80
                            HostName = "*"
                        }

          }
     }
}

I've seen it. 我已经看到了它。

I am using DSC Resource wave 4 / WebAdministration 1.2. 我正在使用DSC Resource wave 4 / WebAdministration 1.2。

I fixed it by going in to the MSFT_xWebsite.psm1 file and replacing: $Website = Get-Website -Name $Name with $Website = Get-Website | Where Name -eq $Name 我通过进入MSFT_xWebsite.psm1文件并替换了它来修复它: $Website = Get-Website -Name $Name$Website = Get-Website | Where Name -eq $Name $Website = Get-Website | Where Name -eq $Name

Get-Website -Name $Name returns all websites on the host, so the library thinks the site exists, but then fails when getting the properties in Test-TargetResource Get-Website -Name $Name返回主机上的所有网站,因此库认为该站点存在,但是在获取Test-TargetResource的属性时失败

I loaded the module directly, using Import-Module MSFT_xWebsite.psm1 , and executed the functions to figure out what was failing. 我使用Import-Module MSFT_xWebsite.psm1直接加载了模块,并执行了函数以找出失败的原因。 The error I got running the module function directly helped me find the failing catch block via the error message. 我运行模块函数的错误直接帮助我通过错误消息找到了失败的catch块。 The line numbers were still useless. 行号仍然没有用。

Hope that helps. 希望能有所帮助。

If you don't want to edit the module yourself as described in the answer above, you can use the corresponding module cWebAdministration from PowerShell.org. 如果不想按上面的答案中所述自行编辑模块,则可以使用PowerShell.org中的相应模块cWebAdministration It fixes the issue and can be imported alongside xWebAdministration if you need more modules than the two of cWebAdministration (cWebSite and cAppPool): 它解决了此问题,如果您需要的模块比cWebAdministration的两个模块(cWebSite和cAppPool)更多,可以与xWebAdministration一起导入:

Import-DscResource -ModuleName cWebAdministration
Import-DscResource -ModuleName xWebAdministration

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

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