概述
每个 元素的 path 属性指定搜索结果配置文件的绝对虚拟路径
注意
如果
每个
每个
注意
兼容性
版本
说明
IIS 10.0
IIS 8.5
IIS 8.0
IIS 7.5
IIS 7.0
IIS 6.0
空值
安装
操作方式
IIS 7 中没有用于配置
配置
特性
无。
子元素
元素
说明
searchResult
包含配置搜索结果的集合。
配置示例
注意
会自动生成
代码示例
下面的代码示例使用
AppCmd.exe
注意
无法使用 AppCmd.exe 查询
C#
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetWebConfiguration("Default Web Site");
ConfigurationSection configPathsSection = config.GetSection("configPaths");
ConfigurationElementCollection searchResultCollection = configPathsSection.GetCollection();
foreach (ConfigurationElement searchResultElement in searchResultCollection)
{
string path = (string)searchResultElement["path"];
string locationPath = (string)searchResultElement["locationPath"];
foreach (ConfigurationElement sectionElement in searchResultElement.GetCollection())
{
if (string.Compare("system.webServer/defaultDocument",
(string)sectionElement["name"], false) == 0)
{
Console.WriteLine("Path: " + path);
if (!String.IsNullOrEmpty(locationPath))
{
Console.WriteLine("\tLocation: " + locationPath);
Console.WriteLine("\t\tName: " + sectionElement["name"]);
}
else Console.WriteLine("\tName: " + sectionElement["name"]);
}
}
}
}
}
}
VB.NET
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetWebConfiguration("Default Web Site")
Dim configPathsSection As ConfigurationSection = config.GetSection("configPaths")
Dim searchResultCollection As ConfigurationElementCollection = configPathsSection.GetCollection
For Each searchResultElement As ConfigurationElement In searchResultCollection
Dim path As String = CType(searchResultElement("path"), String)
Dim locationPath As String = CType(searchResultElement("locationPath"), String)
For Each sectionElement As ConfigurationElement In searchResultElement.GetCollection
If (String.Compare("system.webServer/defaultDocument", _
CType(sectionElement("name"), String), False) = 0) Then
Console.WriteLine(("Path: " + path))
If Not String.IsNullOrEmpty(locationPath) Then
Console.WriteLine((vbTab & "Location: " + locationPath))
Console.WriteLine((vbTab & vbTab & "Name: " + sectionElement("name")))
Else
Console.WriteLine((vbTab & "Name: " + sectionElement("name")))
End If
End If
Next
Next
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject("Microsoft.ApplicationHost.WritableAdminManager");
var configPathsSection = adminManager.GetAdminSection("configPaths", "MACHINE/WEBROOT/APPHOST/Default Web Site");
var searchResultCollection = configPathsSection.Collection;
for (var i = 0; i < searchResultCollection.Count; i++)
{
var searchResultElement = searchResultCollection.Item(i);
var path = searchResultElement.GetPropertyByName("path").Value;
var locationPath = searchResultElement.GetPropertyByName("locationPath").Value;
sectionElementCollection = searchResultElement.Collection;
for (var j = 0; j < sectionElementCollection.Count; j++)
{
var sectionElement = sectionElementCollection.Item(j);
var name = sectionElement.GetPropertyByName("name").Value;
if (name == "system.webServer/defaultDocument")
{
WScript.Echo("Path: " + path);
if (locationPath!="")
{
WScript.Echo("\tLocation: " + locationPath);
WScript.Echo("\t\tName: " + name);
}
else WScript.Echo("\tName: " + name);
}
}
}
VBScript
Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
Set configPathsSection = adminManager.GetAdminSection("configPaths", "MACHINE/WEBROOT/APPHOST/Default Web Site")
Set searchResultCollection = configPathsSection.Collection
For i = 0 To CInt(searchResultCollection.Count) - 1
Set searchResultElement = searchResultCollection.Item(i)
path = searchResultElement.GetPropertyByName("path").Value
locationPath = searchResultElement.GetPropertyByName("locationPath").Value
Set sectionElementCollection = searchResultElement.Collection
For j = 0 To CInt(sectionElementCollection.Count) - 1
Set sectionElement = sectionElementCollection.Item(j)
name = sectionElement.GetPropertyByName("name").Value
If name = "system.webServer/defaultDocument" Then
WScript.Echo "Path: " + path
If locationPath<>"" Then
WScript.Echo(vbTab & "Location: " + locationPath)
WScript.Echo(vbTab & vbTab & "Name: " + name)
Else
WScript.Echo(vbTab & "Name: " + name)
End if
End If
Next
Next
- 用计算机如何修改wif密码,电脑怎么修改无线网(WIFI)密码?电脑怎么修改无线网密码?下面本文给大家讲解用电脑来修改无线网密码(wifi密码)的方法。 首先,大家需要知道的是:无线wifi密码是在路由器...
- 旧时民间流传的符咒、诅咒和赌咒符咒是符篆和咒语的总称。“符"指用朱笔或墨笔在纸上画成似字非字的图画,道书上称之为符篆、丹书、墨箓、云箓、符字等。“咒”是口中诵...
- 一般哪里有卖网线的一般哪里有卖网线的 随着互联网的发展,网络已经成为我们生活中不可或缺的一部分。而网线作为连接电脑和网络的重要工具,也变得越来越普...
- 【海市蜃楼】中国十大海市蜃楼奇观 国内真出现过海市蜃楼的地方连云港海州湾 2005年10月19日下午2时至5时30分,江苏省连云港市海洲湾惊现极为罕见的“海市蜃楼”奇观。在拦海大堤和西墅村偏北方向,与黄海...
- 中国移动流量卡王办理后要多久才能注销(腾讯大王卡申请成功后可以取消吗)今天我们了解一下中国移动流量卡王办理后要多久才能注销以及腾讯大王卡申请成功后可以取消吗的相关内容,拓展问题包含移动的卡不想用了...
- 4t机油是什么机油4t机油是什么机油 4T机油是一种合成机油,其全称为四冲程汽油发动机油。这种机油主要用于汽车、摩托车等四冲程汽油发动机的润滑系统。4T机...
- 华宝信托2024年11月5日起,在成都市委社会工作部的指导下,成都市城乡社区发展治理促进会组建宣讲团,深入成都市各区(市)县开展为期八天的系列宣...
- 游戏《缺氧》上线了吗 饥荒缺氧多久上线问:游戏《缺氧》上线了吗?饥荒缺氧多久上线?Klei缺氧什么时候发售?安卓版什么时候出?游戏什么时候可以玩?iOS版什么时候上架AppStore? 答:《饥...
- 华宝信托2024年11月5日起,在成都市委社会工作部的指导下,成都市城乡社区发展治理促进会组建宣讲团,深入成都市各区(市)县开展为期八天的系列宣...
- 携来百侣曾游,忆往昔峥嵘岁月稠。赏析 该词通过对长沙秋景的描绘和对青年时代革命斗争生活的回忆,抒写出革命青年对国家命运的感慨和以天下为己任,蔑视反动统治者,改造...