在Powershell中获取自定义的web.config部分及其内容
我有一个Web应用程序安装在c:\inetpub\wwwroot_Site1\AppName ,它具有自定义部分组和部分,如下所示: <configSections> <sectionGroup name="Libraries"> <section name="Custom.Section.Name" type="System.Configuration.NameValueSectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/> <section name="Custom.Section.Name2" type="System.Configuration.NameValueSectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/> </sectionGroup> </configSections> 我已经写了Powershell的以下片段: Import-Module WebAdministration Get-WebConfiguration //Libraries IIS:\Sites\Site1\AppName 哪个正确返回: 命名部分组 ==== ======== =========== 库Custom.Section.Name Custom.Section.Name2 我无法理解的是,无论是通过Get-WebConfiguration还是Get-WebConfigurationProperty可以访问实际“body”中的CustomSectionName的直接子元素的<add key="x" value="y" />的configuration文件。